diff --git a/source/debug/FPSCounter.hx b/source/debug/FPSCounter.hx index e774328b508..33786aee619 100644 --- a/source/debug/FPSCounter.hx +++ b/source/debug/FPSCounter.hx @@ -46,19 +46,18 @@ class FPSCounter extends TextField // Event Handlers private override function __enterFrame(deltaTime:Float):Void { - // prevents the overlay from updating every frame, why would you need to anyways - if (deltaTimeout > 1000) { - deltaTimeout = 0.0; - return; - } - final now:Float = haxe.Timer.stamp() * 1000; times.push(now); while (times[0] < now - 1000) times.shift(); + // prevents the overlay from updating every frame, why would you need to anyways @crowplexus + if (deltaTimeout < 1000) { + deltaTimeout += deltaTime; + return; + } currentFPS = times.length < FlxG.updateFramerate ? times.length : FlxG.updateFramerate; updateText(); - deltaTimeout += deltaTime; + deltaTimeout = 0.0; } public dynamic function updateText():Void { // so people can override it in hscript