aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-16 17:31:30 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-16 17:31:30 +0200
commita5ec40e505207841162ab406f60ec46985db7235 (patch)
tree8128ac5929a3cb2bd09e465f03d804ed3e09fdca /src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
parent9521fb420ad494a9cbe0d3c439976fc842fa9194 (diff)
downloadOneConfig-a5ec40e505207841162ab406f60ec46985db7235.tar.gz
OneConfig-a5ec40e505207841162ab406f60ec46985db7235.tar.bz2
OneConfig-a5ec40e505207841162ab406f60ec46985db7235.zip
deltatime things
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java23
1 files changed, 16 insertions, 7 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();
}