diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-03-20 11:19:25 +0200 |
---|---|---|
committer | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-03-20 11:19:25 +0200 |
commit | e00daf8f31df5712b335b3c18ed22b8a8978f9ee (patch) | |
tree | d5799bf0db4bb493997f7a1259e00a2ff7ac3f2d | |
parent | 759ac531c9c7fae317df3f91f25489682fd61117 (diff) | |
download | LibGui-e00daf8f31df5712b335b3c18ed22b8a8978f9ee.tar.gz LibGui-e00daf8f31df5712b335b3c18ed22b8a8978f9ee.tar.bz2 LibGui-e00daf8f31df5712b335b3c18ed22b8a8978f9ee.zip |
Make scroll bars look nicer
-rw-r--r-- | build.gradle | 2 | ||||
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java | 51 |
2 files changed, 46 insertions, 7 deletions
diff --git a/build.gradle b/build.gradle index 790f687..dc89864 100644 --- a/build.gradle +++ b/build.gradle @@ -59,7 +59,7 @@ dependencies { compileOnly ("com.google.code.findbugs:jsr305:3.0.2") { transitive = false } - def modmenu = "1.8.5+build.23" + def modmenu = "1.11.0+build.2" modCompileOnly "io.github.prospector:modmenu:$modmenu" modRuntime "io.github.prospector:modmenu:$modmenu" // for testing } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java index 71ec4e4..795a429 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java @@ -1,5 +1,6 @@ package io.github.cottonmc.cotton.gui.widget; +import io.github.cottonmc.cotton.gui.client.LibGuiClient; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; import io.github.cottonmc.cotton.gui.widget.data.Axis; @@ -21,15 +22,53 @@ public class WScrollBar extends WWidget { } @Override - public void paintBackground(int x, int y) { - ScreenDrawing.drawBeveledPanel(x, y, width, height, 0xFF373737, 0xFF_000000, 0xFFFFFFFF); + public void paintBackground(int x, int y, int mouseX, int mouseY) { + if (LibGuiClient.config.darkMode) { + ScreenDrawing.drawBeveledPanel(x, y, width, height, 0xFF_212121, 0xFF_2F2F2F, 0xFF_5D5D5D); + } else { + ScreenDrawing.drawBeveledPanel(x, y, width, height, 0xFF_373737, 0xFF_8B8B8B, 0xFF_FFFFFF); + } if (maxValue<=0) return; - - int color = 0xFF_FFFFFF; + + // Handle colors + int top, middle, bottom; + + if (sliding) { + if (LibGuiClient.config.darkMode) { + top = 0xFF_6C6C6C; + middle = 0xFF_2F2F2F; + bottom = 0xFF_212121; + } else { + top = 0xFF_FFFFFF; + middle = 0xFF_8B8B8B; + bottom = 0xFF_555555; + } + } else if (isWithinBounds(mouseX, mouseY)) { + if (LibGuiClient.config.darkMode) { + top = 0xFF_5F6A9D; + middle = 0xFF_323F6E; + bottom = 0xFF_0B204A; + } else { + top = 0xFF_CFD0F7; + middle = 0xFF_8791C7; + bottom = 0xFF_343E75; + } + } else { + if (LibGuiClient.config.darkMode) { + top = 0xFF_6C6C6C; + middle = 0xFF_414141; + bottom = 0xFF_212121; + } else { + top = 0xFF_FFFFFF; + middle = 0xFF_C6C6C6; + bottom = 0xFF_555555; + } + } + if (axis==Axis.HORIZONTAL) { - ScreenDrawing.coloredRect(x+1+getHandlePosition(), y+1, getHandleSize(), height-2, color); + ScreenDrawing.drawBeveledPanel(x+1+getHandlePosition(), y+1, getHandleSize(), height-2, top, middle, bottom); } else { - ScreenDrawing.coloredRect(x+1, y+1+getHandlePosition(), width-2, getHandleSize(), color); + ScreenDrawing.drawBeveledPanel(x+1, y+1+getHandlePosition(), width-2, getHandleSize(), top, middle, bottom); } } |