|
@@ -121,7 +121,7 @@ public class Engine
|
|
|
|
|
|
private static void loop(IGame game)
|
|
|
{
|
|
|
- long newTime = glfwGetTimerValue();
|
|
|
+ long newTime = System.nanoTime();
|
|
|
long oldTime;
|
|
|
long lag = 0;
|
|
|
long frameLag = 0;
|
|
@@ -130,7 +130,7 @@ public class Engine
|
|
|
while(!glfwWindowShouldClose(window))
|
|
|
{
|
|
|
oldTime = newTime;
|
|
|
- newTime = glfwGetTimerValue();
|
|
|
+ newTime = System.nanoTime();
|
|
|
lag += newTime - oldTime;
|
|
|
frameLag += newTime - oldTime;
|
|
|
|
|
@@ -164,9 +164,9 @@ public class Engine
|
|
|
frameLag -= nanosPerFrame;
|
|
|
// make sure no frames are rendered immediately after each other
|
|
|
// this happens if the game tick takes too long
|
|
|
- if(lastFrame + nanosPerFrame - 1000000 < glfwGetTimerValue())
|
|
|
+ if(lastFrame + nanosPerFrame - 1000000 < System.nanoTime())
|
|
|
{
|
|
|
- lastFrame = glfwGetTimerValue();
|
|
|
+ lastFrame = System.nanoTime();
|
|
|
|
|
|
game.renderTick(renderer, (float) lag / nanosPerTick);
|
|
|
tpsTimer.draw(renderer);
|