diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-04 13:58:55 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-04 13:58:55 +0200 |
commit | bc48ed611da2ee666651919cfcc4c7046bcede0a (patch) | |
tree | b08d5bd87382f8e3329236df9457847c6b2729fc /src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java | |
parent | 8df18aacd08a0b6caf612a31d578dd6e6d5fa31a (diff) | |
download | OneConfig-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.java | 11 |
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; + } } |