From bc48ed611da2ee666651919cfcc4c7046bcede0a Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 4 Jun 2022 13:58:55 +0200 Subject: button test page --- .../java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements') 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; + } } -- cgit