aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-28 19:18:49 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-28 19:18:49 +0200
commit8a1f8f6a1972216b8ba7b0ce97d4be9ffc45dd7c (patch)
tree59f18f1a44767b53c6b83c99f7c56b1f66a2e9a5 /src/main/java/io/polyfrost
parentef8d18075904cad5c66b6cd97f0963f8405ac4d4 (diff)
downloadOneConfig-8a1f8f6a1972216b8ba7b0ce97d4be9ffc45dd7c.tar.gz
OneConfig-8a1f8f6a1972216b8ba7b0ce97d4be9ffc45dd7c.tar.bz2
OneConfig-8a1f8f6a1972216b8ba7b0ce97d4be9ffc45dd7c.zip
temp
Diffstat (limited to 'src/main/java/io/polyfrost')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java
index eb341f7..8d6fd0e 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java
@@ -18,6 +18,7 @@ public class ConfigPage extends BasicOption {
public final OptionPage page;
public final String description;
private int backgroundColor = OneConfigConfig.GRAY_500;
+ private boolean pressed = false;
public ConfigPage(Field field, String name, String description, int size, OptionPage page) {
super(field, name, size);
@@ -28,11 +29,11 @@ public class ConfigPage extends BasicOption {
@Override
public void draw(long vg, int x, int y) {
boolean hovered = InputUtils.isAreaHovered(x - 2, y, 1023, description.equals("") ? 64 : 96);
- boolean clicked = hovered && Mouse.isButtonDown(0);
+ boolean clicked = pressed && !Mouse.isButtonDown(0);
+ pressed = hovered && Mouse.isButtonDown(0);
backgroundColor = ColorUtils.smoothColor(backgroundColor, OneConfigConfig.GRAY_500, OneConfigConfig.GRAY_400, hovered, 100);
- if (clicked)
- NanoVG.nvgGlobalAlpha(vg, 0.8f);
+ if (clicked) NanoVG.nvgGlobalAlpha(vg, 0.8f);
RenderManager.drawRoundedRect(vg, x - 2, y, 1024, description.equals("") ? 64 : 96, backgroundColor, 20);
RenderManager.drawString(vg, name, x + 24, y + 32, OneConfigConfig.WHITE, 24, Fonts.INTER_MEDIUM);
@@ -43,8 +44,7 @@ public class ConfigPage extends BasicOption {
RenderManager.drawRect(vg, x, y, 1024, 20, OneConfigConfig.WHITE);
RenderManager.drawRect(vg, x, y + 64 - 20, 1024, 20, OneConfigConfig.WHITE);
- if (clicked)
- OneConfigGui.INSTANCE.openPage(new ModConfigPage(page));
+ if (clicked) OneConfigGui.INSTANCE.openPage(new ModConfigPage(page));
NanoVG.nvgGlobalAlpha(vg, 1f);
}