main.ts
| 1 | import { Canvas } from './game/Canvas.ts' |
| 2 | import { GameLoop } from './game/GameLoop.ts' |
| 3 | import { GameState } from './game/GameState.ts' |
| 4 | import { UI } from './game/UI.ts' |
| 5 | |
| 6 | const canvas = new Canvas('game') |
| 7 | const state = new GameState(canvas) |
| 8 | const ui = new UI(state, canvas.el) |
| 9 | |
| 10 | const loop = new GameLoop( |
| 11 | (dt) => state.update(dt), |
| 12 | (alpha) => { canvas.clear(); state.render(alpha); ui.update() }, |
| 13 | ) |
| 14 | |
| 15 | loop.start() |