diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-31 18:20:38 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-31 18:20:38 +0200 |
commit | db27528fc27f42ed0c8082630be0103c9f03dcf3 (patch) | |
tree | f44d12f506fc4374035f7fec0f6d9a8335c85a0a /src/main/java/cc/polyfrost/oneconfig/gui | |
parent | 401b8b498ed5dc6e19ee0320a4cb1688a9186f42 (diff) | |
download | OneConfig-db27528fc27f42ed0c8082630be0103c9f03dcf3.tar.gz OneConfig-db27528fc27f42ed0c8082630be0103c9f03dcf3.tar.bz2 OneConfig-db27528fc27f42ed0c8082630be0103c9f03dcf3.zip |
temp
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java | 16 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java | 5 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java index 6f474c7..2c2abd8 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java @@ -1,8 +1,11 @@ package cc.polyfrost.oneconfig.gui; +import cc.polyfrost.oneconfig.config.OneConfigConfig; import cc.polyfrost.oneconfig.gui.elements.BasicButton; import cc.polyfrost.oneconfig.gui.pages.CreditsPage; import cc.polyfrost.oneconfig.gui.pages.ModsPage; +import cc.polyfrost.oneconfig.lwjgl.RenderManager; +import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.SVGs; import cc.polyfrost.oneconfig.utils.GuiUtils; @@ -32,12 +35,12 @@ public class SideBar { buttons.get(2).setClickAction(new ModsPage()); HUDButton.setClickAction(() -> GuiUtils.displayScreen(new HudGui())); CloseButton.setClickAction(GuiUtils::closeScreen); - for (BasicButton button : buttons) button.setToggleable(true); } public void draw(long vg, int x, int y) { buttons.get(0).draw(vg, x + 16, y + 80); buttons.get(1).draw(vg, x + 16, y + 116); + RenderManager.drawText(vg, "MOD CONFIG", x + 16, y + 178, OneConfigConfig.WHITE, 12, Fonts.SEMIBOLD); buttons.get(2).draw(vg, x + 16, y + 192); buttons.get(3).draw(vg, x + 16, y + 228); buttons.get(4).draw(vg, x + 16, y + 264); @@ -47,5 +50,16 @@ public class SideBar { buttons.get(8).draw(vg, x + 16, y + 448); HUDButton.draw(vg, x + 16, y + 704); CloseButton.draw(vg, x + 16, y + 748); + + for (BasicButton button : buttons) { + if (button.isClicked()) { + button.setColorPalette(PRIMARY); + for (BasicButton button1 : buttons) { + if (button.equals(button1)) continue; + button1.setColorPalette(TERTIARY); + } + break; + } + } } } 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 c2bda06..f8edf78 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java @@ -7,6 +7,7 @@ import cc.polyfrost.oneconfig.lwjgl.RenderManager; import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.SVGs; import cc.polyfrost.oneconfig.utils.ColorUtils; +import org.lwjgl.input.Mouse; public class BasicButton extends BasicElement { @@ -181,11 +182,11 @@ public class BasicButton extends BasicElement { return; } if (!toggleable) { - currentColor = ColorUtils.getColor(currentColor, colorPalette, hovered, clicked); + currentColor = ColorUtils.getColor(currentColor, colorPalette, hovered, hovered && Mouse.isButtonDown(0)); } else { if (toggled) { currentColor = ColorUtils.smoothColor(currentColor, OneConfigConfig.GRAY_500, OneConfigConfig.PRIMARY_600, true, 30f); - } else currentColor = ColorUtils.getColor(currentColor, colorPalette, hovered, clicked); + } else currentColor = ColorUtils.getColor(currentColor, colorPalette, hovered, hovered && Mouse.isButtonDown(0)); } } |