aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/gui/elements/BasicElement.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-02 14:48:22 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-02 14:48:22 +0200
commit63633b2286bd8717f078131014199c6ccaa6a8e3 (patch)
tree33e10d44380a26d1e8608bc5d4b2014f64df5fe0 /src/main/java/io/polyfrost/oneconfig/gui/elements/BasicElement.java
parent401ca42651010ea4a6349a60ddcac64632935510 (diff)
parent63192472f7a814725cbcdaf91eed1361bfc75c38 (diff)
downloadOneConfig-63633b2286bd8717f078131014199c6ccaa6a8e3.tar.gz
OneConfig-63633b2286bd8717f078131014199c6ccaa6a8e3.tar.bz2
OneConfig-63633b2286bd8717f078131014199c6ccaa6a8e3.zip
Merge branch 'master' of github.com:Polyfrost/OneConfig
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/gui/elements/BasicElement.java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/BasicElement.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/BasicElement.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/BasicElement.java
index f31a5ef..dd3956c 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/BasicElement.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/BasicElement.java
@@ -12,6 +12,7 @@ public class BasicElement {
protected boolean hovered = false;
protected boolean clicked = false;
protected boolean toggled = false;
+ protected boolean disabled = false;
protected int currentColor;
public BasicElement(int width, int height, int colorPalette, boolean hoverFx) {
@@ -39,6 +40,11 @@ public class BasicElement {
}
public void update(int x, int y) {
+ if(disabled) {
+ hovered = false;
+ clicked = false;
+ return;
+ }
hovered = InputUtils.isAreaHovered(x - hitBoxX, y - hitBoxY, width + hitBoxX, height + hitBoxY);
clicked = InputUtils.isClicked() && hovered;
@@ -91,4 +97,11 @@ public class BasicElement {
public boolean isToggled() {
return toggled;
}
+
+ public boolean isDisabled() {
+ return disabled;
+ }
+ public void disable(boolean state) {
+ disabled = state;
+ }
}