summaryrefslogtreecommitdiffstats
path: root/src/subconscious/graphics/Scene.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/subconscious/graphics/Scene.java')
-rw-r--r--src/subconscious/graphics/Scene.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/subconscious/graphics/Scene.java b/src/subconscious/graphics/Scene.java
index c5938f1..01b8fe9 100644
--- a/src/subconscious/graphics/Scene.java
+++ b/src/subconscious/graphics/Scene.java
@@ -247,14 +247,15 @@ public abstract class Scene extends Panel
}
// update game and widgets
- this.update(timeDiff);
- this.updateWidgets(timeDiff);
- this.game.update(timeDiff);
+ this.update(Scene.DESIRED_DELTA_LOOP_NS - timeDiff);
+ this.updateWidgets(Scene.DESIRED_DELTA_LOOP_NS - timeDiff);
+ this.game.update(Scene.DESIRED_DELTA_LOOP_NS - timeDiff);
afterTime = System.nanoTime();
timeDiff = afterTime - beforeTime;
sleepTime = (Scene.DESIRED_DELTA_LOOP_NS - timeDiff) - overSleepTime;
+
// if sleep is needed (too fast)
if (sleepTime > 0) {
try {
@@ -265,7 +266,6 @@ public abstract class Scene extends Panel
overSleepTime = (System.nanoTime() - afterTime) - sleepTime;
-
// if sleep is not needed (too slow)
} else {
overSleepTime = 0L;