main.js 571 B

1234567891011121314151617
  1. import { Game } from './game/Game.js';
  2. import { CanvasRenderer } from './libraries/CanvasRenderer.js';
  3. import { Global } from './libraries/Global.js';
  4. document.addEventListener("DOMContentLoaded", () => {
  5. let viewer = document.getElementById('viewer');
  6. let renderer = new CanvasRenderer();
  7. let game = new Game();
  8. game.init().then(() => {
  9. renderer.init(viewer,game);
  10. renderer.start();
  11. Global.updateTickRate = Math.floor(1000/60)
  12. setInterval(() => {
  13. game.update();
  14. }, Global.updateTickRate);
  15. });
  16. });