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