match drawn fps to tick rate always, except for when vsync

This commit is contained in:
RandomityGuy 2025-02-14 21:22:53 +05:30
parent 0edf005ea1
commit 3900bdcf0f

View file

@ -145,7 +145,10 @@ class Main extends hxd.App {
// });
}
static var updateDT:Float;
override function update(dt:Float) {
updateDT = dt;
super.update(dt);
if (loaded) {
ProfilerUI.begin();
@ -177,6 +180,19 @@ class Main extends hxd.App {
ProfilerUI.end();
}
super.render(e);
#if hl
static var dtAccumulator;
dtAccumulator += updateDT;
if (Settings.optionsSettings.fpsLimit <= 0) {
e.driver.present();
} else {
if (dtAccumulator >= 1.0 / Settings.optionsSettings.fpsLimit) {
e.driver.present();
dtAccumulator = 0.0;
}
}
#end
}
static function main() {