25 lines
466 B
JavaScript
25 lines
466 B
JavaScript
import { Scene } from './scene.js';
|
|
import { Settings } from './settings.js';
|
|
import { Pointer } from './pointer.js';
|
|
|
|
export class App {
|
|
constructor(w, h) {
|
|
this.scene = new Scene(w, h);
|
|
this.prevTime = Date.now();
|
|
|
|
Pointer.init();
|
|
|
|
this.run();
|
|
}
|
|
|
|
run = () => {
|
|
let newTime = Date.now();
|
|
Settings.delta = (newTime - this.prevTime) / 1000;
|
|
this.prevTime = newTime;
|
|
|
|
this.scene.run();
|
|
|
|
requestAnimationFrame(this.run);
|
|
}
|
|
}
|