Skip to content

Commit

Permalink
fix fps display
Browse files Browse the repository at this point in the history
  • Loading branch information
KilledByAPixel committed Jan 16, 2024
1 parent 9af7b9b commit 4070dd3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/stress/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'use strict';

// keep our own list of simple sprites and track fps
let sprites, timeMS, showFPS, statsDisplay, spriteColor, spriteAdditiveColor;
let sprites, timeMS, fpsDisplay, statsDisplay, spriteColor, spriteAdditiveColor;

///////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -95,7 +95,7 @@
{
// track fps and update stats
const frameTimeMS = Date.now();
showFPS = lerp(.05, showFPS, 1e3/(frameTimeMS - timeMS||1));
fpsDisplay = lerp(.05, fpsDisplay||0, 1e3/(frameTimeMS - timeMS||1));
timeMS = frameTimeMS;

const spriteCount = sprites.length
Expand All @@ -104,7 +104,7 @@
spriteCount + objectCount ?
spriteCount + ' Sprites\n'
+ objectCount + ' Objects\n'
+ showFPS.toFixed(1) + ' FPS'
+ fpsDisplay.toFixed(1) + ' FPS'
: 'LittleJS Stress Test\nLeft Click = Add Particles\nRight Click = Add Objects';

const size = vec2(.5);
Expand Down

0 comments on commit 4070dd3

Please sign in to comment.