update calculating fps
This commit is contained in:
parent
7a91471a38
commit
ea321fc403
@ -52,9 +52,10 @@ export class App {
|
||||
|
||||
run = () => {
|
||||
// Calculating FPS
|
||||
let newTime = Date.now();
|
||||
Settings.delta = (newTime - Settings.prevTime) / 1000;
|
||||
Settings.prevTime = newTime;
|
||||
let fpsNewTime = Date.now();
|
||||
Settings.fpsDelta = (fpsNewTime - Settings.fpsPrevTime) / 1000;
|
||||
Settings.fpsPrevTime = fpsNewTime;
|
||||
Settings.fps = Math.round(1 / Settings.fpsDelta);
|
||||
|
||||
// clear canvas
|
||||
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
||||
|
Loading…
Reference in New Issue
Block a user