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 e7cac9cd0c
commit 6044889270

View file

@ -137,7 +137,10 @@ class Main extends hxd.App {
// });
}
static var updateDT:Float;
override function update(dt:Float) {
updateDT = dt;
super.update(dt);
if (loaded) {
ProfilerUI.begin();
@ -168,6 +171,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() {