Add button interaction
This commit is contained in:
parent
6223b35536
commit
4a253b0184
12 changed files with 247 additions and 23 deletions
32
js/game/index.mjs
Normal file
32
js/game/index.mjs
Normal file
|
@ -0,0 +1,32 @@
|
|||
import * as graphics from '../graphics/index.mjs';
|
||||
import * as gui from '../gui/index.mjs';
|
||||
import * as assets from '../assets.mjs';
|
||||
import * as input from '../input.mjs';
|
||||
|
||||
export let game;
|
||||
|
||||
export async function init() {
|
||||
game = {
|
||||
state: {
|
||||
room: 'menu',
|
||||
paused: false
|
||||
}
|
||||
};
|
||||
|
||||
graphics.init();
|
||||
await assets.init();
|
||||
gui.init();
|
||||
input.init();
|
||||
|
||||
// Recursive `requestAnimationFrame` can cause problems with Parcel.
|
||||
while(true) {
|
||||
await tick();
|
||||
await new Promise(res => requestAnimationFrame(res));
|
||||
}
|
||||
}
|
||||
|
||||
async function tick() {
|
||||
gui.tick();
|
||||
graphics.render();
|
||||
input.tick();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue