diff options
author | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-06-01 18:03:12 +0100 |
---|---|---|
committer | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-06-01 18:03:12 +0100 |
commit | edcd817d9d6b2493ee76a15d12f21696a99a2d34 (patch) | |
tree | d1056ebe7abdff4c5f91a4b129c0d6a5684a8b77 /src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java | |
parent | 68cc66b387a8a6a226289132dea331e6ecf3f76b (diff) | |
parent | 53494fad20feed812735b36dea31c6b0656bb104 (diff) | |
download | OneConfig-edcd817d9d6b2493ee76a15d12f21696a99a2d34.tar.gz OneConfig-edcd817d9d6b2493ee76a15d12f21696a99a2d34.tar.bz2 OneConfig-edcd817d9d6b2493ee76a15d12f21696a99a2d34.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java index f4da715..0558799 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java @@ -1,6 +1,8 @@ package cc.polyfrost.oneconfig.gui; import cc.polyfrost.oneconfig.config.OneConfigConfig; +import cc.polyfrost.oneconfig.gui.animations.Animation; +import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuart; import cc.polyfrost.oneconfig.gui.elements.BasicButton; import cc.polyfrost.oneconfig.gui.pages.CreditsPage; import cc.polyfrost.oneconfig.gui.pages.ModsPage; @@ -30,14 +32,36 @@ public class SideBar { private final BasicButton HUDButton = new BasicButton(192, SIZE_36, "Edit HUD", SVGs.NOTE_PENCIL_BOLD, null, ALIGNMENT_LEFT, ColorPalette.SECONDARY); private final BasicButton CloseButton = new BasicButton(192, SIZE_36, "Close", SVGs.X_CIRCLE_BOLD, null, ALIGNMENT_LEFT, ColorPalette.SECONDARY_DESTRUCTIVE); + private int selected = 2; + private Animation moveAnimation = null; + public SideBar() { buttons.get(0).setClickAction(new CreditsPage()); buttons.get(2).setClickAction(new ModsPage()); HUDButton.setClickAction(() -> GuiUtils.displayScreen(new HudGui())); CloseButton.setClickAction(GuiUtils::closeScreen); + for (int i = 0; i < buttons.size(); i++) { + if (i == 0 || i == 2) continue; + buttons.get(i).disable(true); + } } public void draw(long vg, int x, int y) { + for (BasicButton button : buttons) { + if (!button.isClicked()) continue; + if (button.equals(buttons.get(selected))) break; + buttons.get(selected).setColorPalette(ColorPalette.TERTIARY); + moveAnimation = new EaseInOutQuart(300, buttons.get(selected).x, button.x, false); + selected = buttons.indexOf(button); + } + if (moveAnimation != null) { + RenderManager.drawRoundedRect(vg, x + 16, moveAnimation.get(), 192, 36, OneConfigConfig.PRIMARY_600, 12); + if (moveAnimation.isFinished()) { + moveAnimation = null; + buttons.get(selected).setColorPalette(ColorPalette.PRIMARY); + } + } + 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); @@ -51,16 +75,5 @@ 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(ColorPalette.PRIMARY); - for (BasicButton button1 : buttons) { - if (button.equals(button1)) continue; - button1.setColorPalette(ColorPalette.TERTIARY); - } - break; - } - } } } |