Skip to content

Commit

Permalink
Update FPSCounter.hx
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanSantiagoYT committed Dec 28, 2024
1 parent 4981345 commit a4b6aa3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/debug/FPSCounter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ class FPSCounter extends TextField
var fpsMultiplier:Float = 1.0;
var deltaTimeout:Float = 0.0;
public var timeoutDelay:Float = 50;
var now:Float = 0;
// Event Handlers
override function __enterFrame(deltaTime:Float):Void
{
final now:Float = haxe.Timer.stamp() * 1000;
if (!ClientPrefs.showFPS) return;
now = haxe.Timer.stamp() * 1000;
times.push(now);
while (times[0] < now - 1000 / fpsMultiplier) times.shift();
if (deltaTimeout <= timeoutDelay)
Expand Down Expand Up @@ -90,11 +92,9 @@ class FPSCounter extends TextField

public dynamic function updateText():Void // so people can override it in hscript
{
text = (ClientPrefs.showFPS ? "FPS: " + (ClientPrefs.ffmpegMode ? ClientPrefs.targetFPS : Math.round(currentFPS)) : "");
text = "FPS: " + (ClientPrefs.ffmpegMode ? ClientPrefs.targetFPS : Math.round(currentFPS));
if (ClientPrefs.ffmpegMode)
{
text += " (Rendering Mode)";
}

if (ClientPrefs.showRamUsage) text += "\nRAM: " + FlxStringUtil.formatBytes(memory) + (ClientPrefs.showMaxRamUsage ? " / " + FlxStringUtil.formatBytes(mempeak) : "");
if (ClientPrefs.debugInfo)
Expand Down

0 comments on commit a4b6aa3

Please sign in to comment.