aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-03-20 11:22:46 +0200
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-03-20 11:22:46 +0200
commit9785697d9f56ca7b577b4a0736de2a0dd904d03c (patch)
treea18e6675994733847f4606110d7cf0dce6e626d9
parentcea074d422eba960a73e6df06c96fecbf5ca1385 (diff)
downloadLibGui-9785697d9f56ca7b577b4a0736de2a0dd904d03c.tar.gz
LibGui-9785697d9f56ca7b577b4a0736de2a0dd904d03c.tar.bz2
LibGui-9785697d9f56ca7b577b4a0736de2a0dd904d03c.zip
Make scroll bars look nicer
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java53
1 files changed, 46 insertions, 7 deletions
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..7f7dc84 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;
@@ -19,17 +20,55 @@ public class WScrollBar extends WWidget {
public WScrollBar(Axis axis) {
this.axis = axis;
}
-
+
@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);
}
}