aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-15 18:51:02 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-15 18:51:02 +0200
commit8500111ec9225875c85c03692efbf2dc2c2198dc (patch)
tree372c1b0bd63c1208cc6af1df154755bffd8a2c7f /src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
parent22f9e4df5c76b7a7e2d403f71cab18e2ddfc45f9 (diff)
downloadOneConfig-8500111ec9225875c85c03692efbf2dc2c2198dc.tar.gz
OneConfig-8500111ec9225875c85c03692efbf2dc2c2198dc.tar.bz2
OneConfig-8500111ec9225875c85c03692efbf2dc2c2198dc.zip
bug fixes
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
index 4652ae0..fd8d3d6 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
@@ -54,11 +54,8 @@ public class SideBar {
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).y, button.y, false);
- sizeAnimation = new DummyAnimation(36);
- selected = buttons.indexOf(button);
+ moveSideBar(button);
+ break;
}
if (moveAnimation != null) {
RenderManager.drawRoundedRect(vg, x + 16, moveAnimation.get() - (sizeAnimation.get() - 36) / 2f, 192, sizeAnimation.get(0), Colors.PRIMARY_600, 12);
@@ -83,4 +80,20 @@ public class SideBar {
HUDButton.draw(vg, x + 16, y + 704);
CloseButton.draw(vg, x + 16, y + 748);
}
+
+ public void pageOpened(String page) {
+ for (BasicButton button : buttons) {
+ if (!button.getText().equalsIgnoreCase(page)) continue;
+ moveSideBar(button);
+ return;
+ }
+ }
+
+ private void moveSideBar(BasicButton button) {
+ if (button.equals(buttons.get(selected))) return;
+ buttons.get(selected).setColorPalette(ColorPalette.TERTIARY);
+ moveAnimation = new EaseInOutQuart(300, buttons.get(selected).y, button.y, false);
+ sizeAnimation = new DummyAnimation(36);
+ selected = buttons.indexOf(button);
+ }
}