diff options
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui')
8 files changed, 24 insertions, 18 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java index 7ac0371..8becc0c 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java @@ -14,10 +14,7 @@ import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor; import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager; import cc.polyfrost.oneconfig.utils.InputUtils; import cc.polyfrost.oneconfig.utils.MathUtils; -import gg.essential.universal.UKeyboard; -import gg.essential.universal.UMatrixStack; -import gg.essential.universal.UResolution; -import gg.essential.universal.UScreen; +import gg.essential.universal.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.lwjgl.input.Mouse; @@ -40,7 +37,9 @@ public class OneConfigGui extends UScreen { private ColorSelector currentColorSelector; public boolean mouseDown; private float scale = 1f; - public static OneConfigGui instanceToRestore = null; + private static OneConfigGui instanceToRestore = null; + private long time = -1L; + private long deltaTime = 17L; public boolean allowClose = true; public OneConfigGui() { @@ -72,6 +71,12 @@ public class OneConfigGui extends UScreen { currentPage = new HomePage(); parents.add(currentPage); } + if (time == -1) time = UMinecraft.getTime(); + else { + long currentTime = UMinecraft.getTime(); + deltaTime = currentTime - time; + time = currentTime; + } scale = Math.min(UResolution.getWindowWidth() / 1920f, UResolution.getWindowHeight() / 1080f); if (scale < 1) scale = Math.min(Math.min(1f, UResolution.getWindowWidth() / 1280f), Math.min(1f, UResolution.getWindowHeight() / 800f)); @@ -133,7 +138,7 @@ public class OneConfigGui extends UScreen { Scissor scissor = ScissorManager.scissor(vg, x + 224, y + 88, 1056, 698); if (prevPage != null) { - pageProgress = MathUtils.easeInOutCirc(50, pageProgress, 832 - pageProgress, 220); + pageProgress = MathUtils.easeInOutCirc(50, pageProgress, 832 - pageProgress, 600); prevPage.scrollWithDraw(vg, (int) (x - pageProgress), y + 72); RenderManager.drawLine(vg, (int) (x - pageProgress + 1055), y + 72, (int) (x - pageProgress + 1057), y + 800, 2, OneConfigConfig.GRAY_700); // TODO might remove this currentPage.scrollWithDraw(vg, (int) (x - pageProgress + 1056), y + 72); @@ -244,6 +249,10 @@ public class OneConfigGui extends UScreen { return textInputField.getInput(); } + public long getDeltaTime() { + return deltaTime; + } + @Override public boolean doesGuiPauseGame() { return false; @@ -252,7 +261,7 @@ public class OneConfigGui extends UScreen { @Override public void onScreenClose() { currentPage.finishUpAndClose(); - instanceToRestore = this; + //instanceToRestore = this; INSTANCE = null; super.onScreenClose(); } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java index 19d48a1..059e69d 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java @@ -33,15 +33,12 @@ public class SideBar { btnList.add(new BasicButton(192, 36, "Packs Library", SVGs.BOX, null, -3, BasicButton.ALIGNMENT_LEFT)); btnList.add(new BasicButton(192, 36, "Packs Browser", SVGs.SEARCH, null, -3, BasicButton.ALIGNMENT_LEFT)); btnList.add(new BasicButton(192, 36, "Close", SVGs.X_CIRCLE, null, -1, BasicButton.ALIGNMENT_LEFT, () -> UScreen.displayScreen(null))); - btnList.add(new BasicButton(192, 36, "Minimize", SVGs.MINIMISE, null, -1, BasicButton.ALIGNMENT_LEFT, () -> { - OneConfigGui.instanceToRestore = OneConfigGui.INSTANCE; - UScreen.displayScreen(null); - })); + btnList.add(new BasicButton(192, 36, "Minimize", SVGs.MINIMISE, null, -1, BasicButton.ALIGNMENT_LEFT, () -> UScreen.displayScreen(null))); btnList.add(new BasicButton(192, 36, "Edit HUD", SVGs.HUD, null, 0, BasicButton.ALIGNMENT_LEFT, () -> UScreen.displayScreen(new HudGui()))); } public void draw(long vg, int x, int y) { - currentY = MathUtils.easeInOutCirc(50, currentY, targetY - currentY, 120); + currentY = MathUtils.easeInOutCirc(50, currentY, targetY - currentY, 400); RenderManager.drawRoundedRect(vg, x + 16, y + currentY, 192, 36, OneConfigConfig.BLUE_600, OneConfigConfig.CORNER_RADIUS); int i = 0; if (targetY == 0) { diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java index faef4ef..d569b1b 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java @@ -128,7 +128,7 @@ public class ColorSelector { } i += 128; } - percentMove = MathUtils.easeOut(percentMove, mode, 18f); + percentMove = MathUtils.easeOut(percentMove, mode, 100f); RenderManager.drawString(vg, "HSB Box", x + 55, y + 81, OneConfigConfig.WHITE, 12f, Fonts.MEDIUM); RenderManager.drawString(vg, "Color Wheel", x + 172.5f, y + 81, OneConfigConfig.WHITE, 12f, Fonts.MEDIUM); diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java index 4553739..2dbf181 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java @@ -48,7 +48,7 @@ public class ConfigCheckbox extends BasicOption { } color = ColorUtils.smoothColor(color, OneConfigConfig.GRAY_600, OneConfigConfig.GRAY_400, hover, 40f); RenderManager.drawString(vg, name, x + 32, y + 17, OneConfigConfig.WHITE_90, 14f, Fonts.MEDIUM); - percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 5f)); + percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 50f)); if (percentOn != 0 && percentOn != 1f) { RenderManager.drawRoundedRect(vg, x, y + 4, 24, 24, ColorUtils.setAlpha(OneConfigConfig.BLUE_500, (int) (percentOn * 255)), 6f); RenderManager.drawSvg(vg, SVGs.CHECKBOX_TICK, x, y + 4, 24, 24, new Color(1f, 1f, 1f, percentOn).getRGB()); diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java index 42c8fea..afe1888 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java @@ -51,6 +51,6 @@ public class ConfigDualOption extends BasicOption { e.printStackTrace(); } } - percentMove = MathUtils.clamp(MathUtils.easeOut(percentMove, toggled ? 1f : 0f, 10)); + percentMove = MathUtils.clamp(MathUtils.easeOut(percentMove, toggled ? 1f : 0f, 75)); } } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java index aa0dc1d..187d58d 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java @@ -46,7 +46,7 @@ public class ConfigSwitch extends BasicOption { e.printStackTrace(); } } - percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 10)); + percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 75)); NanoVG.nvgGlobalAlpha(vg, 1f); } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java index e8927fd..e721f16 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java @@ -70,7 +70,7 @@ public class ConfigUniSelector extends BasicOption { } percentMove = selected < previous ? 0f : 1f; } - if (previous != -1) percentMove = MathUtils.easeOut(percentMove, selected < previous ? 1f : 0f, 10); + if (previous != -1) percentMove = MathUtils.easeOut(percentMove, selected < previous ? 1f : 0f, 75); if ((selected < previous ? 1f : 0f) == percentMove) previous = -1; NanoVG.nvgGlobalAlpha(vg, 1f); } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java index 22d162f..fdb5292 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java @@ -48,7 +48,7 @@ public abstract class Page { if (scrollTarget > 0f) scrollTarget = 0f; else if (scrollTarget < -maxScroll + 728) scrollTarget = -maxScroll + 728; - currentScroll = MathUtils.easeOut(currentScroll, scrollTarget, 10f); + currentScroll = MathUtils.easeOut(currentScroll, scrollTarget, 50f); ScissorManager.resetScissor(vg, scissor); } |