diff options
Diffstat (limited to 'src/main/java/cc')
10 files changed, 15 insertions, 13 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java index d0e0625..884b2d1 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java @@ -137,7 +137,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, 600, deltaTime); + 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); diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java index 11e9c6e..78b3a3c 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java @@ -37,7 +37,7 @@ public class SideBar { } public void draw(long vg, int x, int y) { - currentY = MathUtils.easeInOutCirc(50, currentY, targetY - currentY, 400, OneConfigGui.INSTANCE.getDeltaTime()); + 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 3b37b53..dc257a8 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java @@ -129,7 +129,7 @@ public class ColorSelector { } i += 128; } - percentMove = MathUtils.easeOut(percentMove, mode, 100f, OneConfigGui.INSTANCE.getDeltaTime()); + 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 4c864ec..b969ce1 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 @@ -47,7 +47,7 @@ public class ConfigCheckbox extends BasicOption { RenderManager.drawHollowRoundRect(vg, x, y + 4, 23.5f, 23.5f, OneConfigConfig.GRAY_300, 6f, 1f); // the 0.5f is to make it look better ok } RenderManager.drawString(vg, name, x + 32, y + 17, OneConfigConfig.WHITE_90, 14f, Fonts.MEDIUM); - percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 50f, OneConfigGui.INSTANCE.getDeltaTime())); + 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 cc1af3c..a87db85 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 @@ -57,6 +57,6 @@ public class ConfigDualOption extends BasicOption { e.printStackTrace(); } } - percentMove = MathUtils.clamp(MathUtils.easeOut(percentMove, toggled ? 1f : 0f, 75, OneConfigGui.INSTANCE.getDeltaTime())); + 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 5eadad2..4c3658f 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 @@ -48,7 +48,7 @@ public class ConfigSwitch extends BasicOption { e.printStackTrace(); } } - percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 75, OneConfigGui.INSTANCE.getDeltaTime())); + percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 75)); RenderManager.withAlpha(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 ccda382..98aa6e0 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 @@ -80,7 +80,7 @@ public class ConfigUniSelector extends BasicOption { } percentMove = selected < previous ? 0f : 1f; } - if (previous != -1) percentMove = MathUtils.easeOut(percentMove, selected < previous ? 1f : 0f, 75, OneConfigGui.INSTANCE.getDeltaTime()); + if (previous != -1) percentMove = MathUtils.easeOut(percentMove, selected < previous ? 1f : 0f, 75); if ((selected < previous ? 1f : 0f) == percentMove) previous = -1; RenderManager.withAlpha(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 b4ab9e7..1fbea21 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java @@ -49,7 +49,7 @@ public abstract class Page { if (scrollTarget > 0f) scrollTarget = 0f; else if (scrollTarget < -maxScroll + 728) scrollTarget = -maxScroll + 728; - currentScroll = MathUtils.easeOut(currentScroll, scrollTarget, 50f, OneConfigGui.INSTANCE.getDeltaTime()); + currentScroll = MathUtils.easeOut(currentScroll, scrollTarget, 50f); ScissorManager.resetScissor(vg, scissor); } diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/ColorUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/ColorUtils.java index 2e48bdc..165d201 100644 --- a/src/main/java/cc/polyfrost/oneconfig/utils/ColorUtils.java +++ b/src/main/java/cc/polyfrost/oneconfig/utils/ColorUtils.java @@ -1,7 +1,6 @@ package cc.polyfrost.oneconfig.utils; import cc.polyfrost.oneconfig.config.OneConfigConfig; -import cc.polyfrost.oneconfig.gui.OneConfigGui; import java.awt.*; @@ -71,8 +70,7 @@ public class ColorUtils { } private static float smooth(float current, float min, float max, boolean moveToFinal, float speed) { - float deltaTime = OneConfigGui.INSTANCE == null ? 16 : OneConfigGui.INSTANCE.getDeltaTime(); - current = MathUtils.easeOut(current, moveToFinal ? 1f : 0f, speed, deltaTime); + current = MathUtils.easeOut(current, moveToFinal ? 1f : 0f, speed); if (current <= min) { current = min; } diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java index e86061a..a09b398 100644 --- a/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java +++ b/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java @@ -1,5 +1,7 @@ package cc.polyfrost.oneconfig.utils; +import cc.polyfrost.oneconfig.gui.OneConfigGui; + public class MathUtils { public static float clamp(float number) { return number < 0f ? 0f : Math.min(number, 1f); @@ -9,7 +11,8 @@ public class MathUtils { return number < min ? min : Math.min(number, max); } - public static float easeOut(float current, float goal, float speed, float deltaTime) { + public static float easeOut(float current, float goal, float speed) { + float deltaTime = OneConfigGui.INSTANCE == null ? 16 : OneConfigGui.INSTANCE.getDeltaTime(); if (Math.round(Math.abs(goal - current) * 100) > 0) { return current + (goal - current) / speed * deltaTime; } else { @@ -24,7 +27,8 @@ public class MathUtils { /** * taken from <a href="https://github.com/jesusgollonet/processing-penner-easing">https://github.com/jesusgollonet/processing-penner-easing</a> */ - public static float easeInOutCirc(float t, float b, float c, float d, float deltaTime) { + public static float easeInOutCirc(float t, float b, float c, float d) { + float deltaTime = OneConfigGui.INSTANCE == null ? 16 : OneConfigGui.INSTANCE.getDeltaTime(); c *= deltaTime; if ((t /= d / 2) < 1) return -c / 2 * ((float) Math.sqrt(1 - t * t) - 1) + b; return c / 2 * ((float) Math.sqrt(1 - (t -= 2) * t) + 1) + b; |