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