aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-04 13:58:55 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-04 13:58:55 +0200
commitbc48ed611da2ee666651919cfcc4c7046bcede0a (patch)
treeb08d5bd87382f8e3329236df9457847c6b2729fc /src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
parent8df18aacd08a0b6caf612a31d578dd6e6d5fa31a (diff)
downloadOneConfig-bc48ed611da2ee666651919cfcc4c7046bcede0a.tar.gz
OneConfig-bc48ed611da2ee666651919cfcc4c7046bcede0a.tar.bz2
OneConfig-bc48ed611da2ee666651919cfcc4c7046bcede0a.zip
button test page
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java11
1 files changed, 8 insertions, 3 deletions
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 d7e5c9e..c240afd 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
@@ -63,12 +63,13 @@ public class BasicButton extends BasicElement {
this.y = y;
this.update(x, y);
if (disabled) RenderManager.setAlpha(vg, 0.5f);
- RenderManager.drawRoundedRect(vg, x, y, this.width, this.height, colorPalette == ColorPalette.TERTIARY || colorPalette == ColorPalette.TERTIARY_DESTRUCTIVE ? OneConfigConfig.TRANSPARENT : currentColor, this.cornerRadius);
float contentWidth = 0f;
int color = -1;
- if (colorPalette == ColorPalette.TERTIARY || colorPalette == ColorPalette.TERTIARY_DESTRUCTIVE) {
+ if (colorPalette == ColorPalette.TERTIARY || colorPalette == ColorPalette.TERTIARY_DESTRUCTIVE)
color = currentColor;
- }
+ else
+ RenderManager.drawRoundedRect(vg, x, y, this.width, this.height, currentColor, this.cornerRadius);
+
final float middle = x + width / 2f;
final float middleYIcon = y + height / 2f - iconSize / 2f;
final float middleYText = y + height / 2f + fontSize / 8f;
@@ -163,4 +164,8 @@ public class BasicButton extends BasicElement {
public void setRightIcon(SVGs icon) {
icon2 = icon;
}
+
+ public boolean hasClickAction() {
+ return page != null || runnable != null;
+ }
}