aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-03 20:50:15 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-03 20:50:15 +0200
commit07741d92fa6ea636b8292bb35706c25e5e6a72cc (patch)
treef87a5c6de29417b5bf7bbdbdf07c81e4f5fe662f /src/main
parent91da97c6843b76829a6b8cf1321f3d38f4e8893b (diff)
downloadOneConfig-07741d92fa6ea636b8292bb35706c25e5e6a72cc.tar.gz
OneConfig-07741d92fa6ea636b8292bb35706c25e5e6a72cc.tar.bz2
OneConfig-07741d92fa6ea636b8292bb35706c25e5e6a72cc.zip
OC-66 almost done
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java7
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java20
3 files changed, 20 insertions, 11 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
index 420f1d0..39130f0 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
@@ -46,4 +46,11 @@ public class ColorAnimation {
this.palette = palette;
prevState = 3;
}
+
+ public void setColors(float[] colors) {
+ redAnimation = new DummyAnimation(colors[0]);
+ greenAnimation = new DummyAnimation(colors[1]);
+ blueAnimation = new DummyAnimation(colors[2]);
+ alphaAnimation = new DummyAnimation(colors[3]);
+ }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
index bc2bcae..afccbe3 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
@@ -122,8 +122,8 @@ public class BasicButton extends BasicElement {
} else if (this.runnable != null) {
runnable.run();
}
- if (toggleable && toggled) colorPalette = ColorPalette.PRIMARY;
- else if (toggleable) colorPalette = ColorPalette.SECONDARY;
+ if (toggleable && toggled) setColorPalette(ColorPalette.PRIMARY);
+ else if (toggleable) setColorPalette(ColorPalette.SECONDARY);
}
/*@Override
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
index c146742..3ff61a1 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
@@ -47,19 +47,19 @@ public class BasicElement {
hovered = false;
pressed = false;
clicked = false;
- return;
+ } else {
+ hovered = InputUtils.isAreaHovered(x - hitBoxX, y - hitBoxY, width + hitBoxX, height + hitBoxY);
+ pressed = hovered && Mouse.isButtonDown(0);
+ clicked = InputUtils.isClicked(block) && hovered;
+
+ if (clicked) {
+ toggled = !toggled;
+ onClick();
+ }
}
- hovered = InputUtils.isAreaHovered(x - hitBoxX, y - hitBoxY, width + hitBoxX, height + hitBoxY);
- pressed = hovered && Mouse.isButtonDown(0);
- clicked = InputUtils.isClicked(block) && hovered;
if (hoverFx) currentColor = colorAnimation.getColor(hovered, pressed);
else currentColor = colorAnimation.getColor(false, false);
-
- if (clicked) {
- toggled = !toggled;
- onClick();
- }
}
public void ignoreBlockedTouches(boolean state) {
@@ -85,6 +85,8 @@ public class BasicElement {
}
public void setColorPalette(ColorPalette colorPalette) {
+ if (this.colorPalette.equals(ColorPalette.TERTIARY) || this.colorPalette.equals(ColorPalette.TERTIARY_DESTRUCTIVE))
+ this.colorAnimation.setColors(colorPalette.getNormalColorf());
this.colorPalette = colorPalette;
this.colorAnimation.setPalette(colorPalette);
}