diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java | 18 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java | 11 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java index 6e9c1a5..5432b23 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java @@ -56,11 +56,9 @@ public class OneConfigGui extends UScreen { public static OneConfigGui create() { try { - //return instanceToRestore == null ? new OneConfigGui() : instanceToRestore; - return new OneConfigGui(); + return instanceToRestore == null ? new OneConfigGui() : instanceToRestore; } finally { - //if (instanceToRestore != null) INSTANCE = instanceToRestore; - instanceToRestore = null; + if (instanceToRestore != null) INSTANCE = instanceToRestore; } } @@ -143,8 +141,13 @@ public class OneConfigGui extends UScreen { ScissorManager.scissor(vg, x + 224, y + 88, 1056, 698); if (prevPage != null && animation != null) { float pageProgress = animation.get(deltaTime); - prevPage.scrollWithDraw(vg, (int) (x + pageProgress), y + 72); - currentPage.scrollWithDraw(vg, (int) (x - 1904 + pageProgress), y + 72); + if (!animation.isReversed()) { + prevPage.scrollWithDraw(vg, (int) (x + pageProgress), y + 72); + currentPage.scrollWithDraw(vg, (int) (x - 1904 + pageProgress), y + 72); + } else { + prevPage.scrollWithDraw(vg, (int) (x - 1904 + pageProgress), y + 72); + currentPage.scrollWithDraw(vg, (int) (x + pageProgress), y + 72); + } if (animation.isFinished()) { prevPage = null; } @@ -199,6 +202,7 @@ public class OneConfigGui extends UScreen { public void openPage(@NotNull Page page, boolean addToPrevious) { openPage(page, new EaseInOutQuad(300, 224, 2128, false), addToPrevious); } + public void openPage(@NotNull Page page, Animation animation, boolean addToPrevious) { if (page == currentPage) return; currentPage.finishUpAndClose(); @@ -260,6 +264,7 @@ public class OneConfigGui extends UScreen { public String getSearchValue() { return textInputField.getInput(); } + public long getDeltaTime() { return deltaTime; } @@ -267,6 +272,7 @@ public class OneConfigGui extends UScreen { public static long getDeltaTimeNullSafe() { return OneConfigGui.INSTANCE == null ? 17 : OneConfigGui.INSTANCE.getDeltaTime(); } + @Override public boolean doesGuiPauseGame() { return false; diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java index 84ba5fb..156f782 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java @@ -15,9 +15,10 @@ import java.awt.*; import java.lang.reflect.Field; import java.util.Arrays; -public class ConfigDropdown extends BasicOption { // TODO: remove dividers and fix corners +public class ConfigDropdown extends BasicOption { private final String[] options; private final ColorAnimation backgroundColor = new ColorAnimation(ColorPalette.SECONDARY); + private final ColorAnimation atomColor = new ColorAnimation(new ColorPalette(OneConfigConfig.PRIMARY_600, OneConfigConfig.PRIMARY_500, OneConfigConfig.PRIMARY_500)); private boolean opened = false; public ConfigDropdown(Field field, Object parent, String name, int size, String[] options) { @@ -53,12 +54,12 @@ public class ConfigDropdown extends BasicOption { // TODO: remove dividers and f if (size == 1) { RenderManager.drawRoundedRect(vg, x + 224, y, 256, 32, backgroundColor.getColor(hovered, hovered && Mouse.isButtonDown(0)), 12); RenderManager.drawText(vg, options[selected], x + 236, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); - RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, hovered ? OneConfigConfig.PRIMARY_500 : OneConfigConfig.PRIMARY_600, 8); + RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, atomColor.getColor(hovered, false), 8); RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 452, y + 4, 24, 24); } else { RenderManager.drawRoundedRect(vg, x + 352, y, 640, 32, backgroundColor.getColor(hovered, hovered && Mouse.isButtonDown(0)), 12); RenderManager.drawText(vg, options[selected], x + 364, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); - RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, hovered ? OneConfigConfig.PRIMARY_500 : OneConfigConfig.PRIMARY_600, 8); + RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, atomColor.getColor(hovered, false), 8); RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 964, y + 4, 24, 24); } RenderManager.setAlpha(vg, 1f); @@ -83,7 +84,7 @@ public class ConfigDropdown extends BasicOption { // TODO: remove dividers and f RenderManager.drawRoundedRect(vg, x + 224, y, 256, 32, backgroundColor.getColor(hovered, hovered && Mouse.isButtonDown(0)), 12); RenderManager.drawText(vg, options[selected], x + 236, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); if (hovered && Mouse.isButtonDown(0)) RenderManager.setAlpha(vg, 0.8f); - RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, hovered ? OneConfigConfig.PRIMARY_500 : OneConfigConfig.PRIMARY_600, 8); + RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, atomColor.getColor(hovered, false), 8); RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 452, y + 4, 24, 24); RenderManager.setAlpha(vg, 1f); @@ -116,7 +117,7 @@ public class ConfigDropdown extends BasicOption { // TODO: remove dividers and f RenderManager.drawRoundedRect(vg, x + 352, y, 640, 32, backgroundColor.getColor(hovered, hovered && Mouse.isButtonDown(0)), 12); RenderManager.drawText(vg, options[selected], x + 364, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); if (hovered && Mouse.isButtonDown(0)) RenderManager.setAlpha(vg, 0.8f); - RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, hovered ? OneConfigConfig.PRIMARY_500 : OneConfigConfig.PRIMARY_600, 8); + RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, atomColor.getColor(hovered, false), 8); RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 964, y + 4, 24, 24); RenderManager.setAlpha(vg, 1f); |