diff --git a/src/Main.hx b/src/Main.hx index 1ce70815..d3dca0fc 100644 --- a/src/Main.hx +++ b/src/Main.hx @@ -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() {