FIXED AND WORKING... BACKUP IF IT GOES WRONG

This commit is contained in:
2022-01-29 15:52:02 +02:00
parent fa4e27999a
commit e11a283b2c
94 changed files with 2174 additions and 62 deletions

27
src/app/home/deltaTime.ts Normal file
View File

@@ -0,0 +1,27 @@
export class DeltaTime {
private lastTick: number;
private static instance: DeltaTime;
private deltaTime: number;
private constructor() {
this.lastTick = Date.now();
}
public static getInstance() {
if (!this.instance) {
this.instance = new DeltaTime();
}
return this.instance;
}
public updateDeltaTime() {
const time = Date.now();
this.deltaTime = time - this.lastTick;
this.lastTick = time;
}
public getDeltaTime(): number {
return this.deltaTime;
}
}