Skip to content

Commit be1b065

Browse files
Fixed weird stuttering when moving
Probably from a JDK update
1 parent d8ae50a commit be1b065

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/main/java/me/toast/dm/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static void main(String[] args) {
1616
Mod.Window.PollEvents();
1717
Mod.Window.Clear();
1818

19-
Mod.Update(Time.deltaTime);
19+
Mod.Update((float)Time.deltaTime);
2020
Mod.Render();
2121

2222
Mod.Window.SwapBuffers();

src/main/java/me/toast/engine/util/Time.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package me.toast.engine.util;
22

3+
import static org.lwjgl.glfw.GLFW.glfwGetTime;
4+
35
public class Time {
46

5-
public static float timeStarted = System.nanoTime();
6-
public static float getTime() { return (float)((System.nanoTime() - timeStarted) * 1E-9); }
7-
public static float deltaTime = 0f;
8-
private static float endTime, beginTime;
7+
public static double timeStarted = Time.getTime();
8+
public static double deltaTime = 0f;
9+
private static double endTime, beginTime;
910

1011
public static void Init() {
1112
deltaTime = 0f;
@@ -18,4 +19,8 @@ public static void UpdateDeltaTime() {
1819
deltaTime = endTime - beginTime;
1920
beginTime = Time.getTime();
2021
}
22+
23+
public static double getTime() {
24+
return glfwGetTime();
25+
}
2126
}

0 commit comments

Comments
 (0)