Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overlay updating every frame instead of every second #15483

Merged
merged 2 commits into from
Sep 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix fps counting
  • Loading branch information
crowplexus committed Sep 7, 2024
commit a0d49843bd418c4f66541591b3198981394d09d9
7 changes: 3 additions & 4 deletions source/debug/FPSCounter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@ class FPSCounter extends TextField
// Event Handlers
private override function __enterFrame(deltaTime:Float):Void
{
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;
}

final now:Float = haxe.Timer.stamp() * 1000;
times.push(now);
while (times[0] < now - 1000) times.shift();

currentFPS = times.length < FlxG.updateFramerate ? times.length : FlxG.updateFramerate;
updateText();
deltaTimeout = 0.0;
Expand Down
Loading