Attempt to reduce CPU usage a bit with new update loop

This commit is contained in:
Pazaz 2022-04-23 17:47:54 -04:00
parent 4bac15d704
commit 4641ea3d38

View file

@ -532,6 +532,13 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
this.mainInputLoop();
this.mainRedrawWrapper();
lastDrawTime = currentTime;
if (VARIABLE_RENDER_RATE > minimumDelay) {
timer.sleep(minimumDelay, (int) VARIABLE_RENDER_RATE);
} else {
// encourage thread switching
Thread.yield();
}
}
}
} catch (@Pc(198) Exception ex) {