aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-04 22:34:51 +0700
committerGitHub <noreply@github.com>2022-06-04 17:34:51 +0200
commit3e472ea407d128de61820fc167e08b8fe24186c9 (patch)
tree587d418150494680e9ca9eb6f43e809305ff1378 /src/main/java/cc/polyfrost/oneconfig/gui
parent88d9478c8ad01742e8395251c4d3e4f1c07812cc (diff)
downloadOneConfig-3e472ea407d128de61820fc167e08b8fe24186c9.tar.gz
OneConfig-3e472ea407d128de61820fc167e08b8fe24186c9.tar.bz2
OneConfig-3e472ea407d128de61820fc167e08b8fe24186c9.zip
move deltaTicks to GuiUtils (#33)
* move from mod events to mixin * packet events * move deltaTicks to GuiUtils * delete easeOut
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java19
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java4
2 files changed, 4 insertions, 19 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index 27ff322..5985d12 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -14,6 +14,7 @@ import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
+import cc.polyfrost.oneconfig.utils.GuiUtils;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import cc.polyfrost.oneconfig.utils.InputUtils;
import org.jetbrains.annotations.NotNull;
@@ -37,8 +38,6 @@ public class OneConfigGui extends UScreen {
public boolean mouseDown;
private float scale = 1f;
public static OneConfigGui instanceToRestore = null;
- private long time = -1L;
- private long deltaTime = 17L;
public boolean allowClose = true;
private Animation animation;
@@ -72,12 +71,6 @@ public class OneConfigGui extends UScreen {
currentPage = new ModsPage();
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));
@@ -139,7 +132,7 @@ public class OneConfigGui extends UScreen {
ScissorManager.scissor(vg, x + 224, y + 88, 1056, 698);
if (prevPage != null && animation != null) {
- float pageProgress = animation.get(deltaTime);
+ float pageProgress = animation.get(GuiUtils.getDeltaTime());
if (!animation.isReversed()) {
prevPage.scrollWithDraw(vg, (int) (x + pageProgress), y + 72);
currentPage.scrollWithDraw(vg, (int) (x - 1904 + pageProgress), y + 72);
@@ -264,14 +257,6 @@ public class OneConfigGui extends UScreen {
return textInputField.getInput();
}
- public long getDeltaTime() {
- return deltaTime;
- }
-
- 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/animations/Animation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java
index 9e2c238..069a807 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.gui.animations;
-import cc.polyfrost.oneconfig.gui.OneConfigGui;
+import cc.polyfrost.oneconfig.utils.GuiUtils;
public abstract class Animation {
private final float duration;
@@ -41,7 +41,7 @@ public abstract class Animation {
* @return The new value
*/
public float get() {
- return get(OneConfigGui.getDeltaTimeNullSafe());
+ return get(GuiUtils.getDeltaTime());
}
/**