Switch to rollup for bundling
This commit is contained in:
parent
fc8d282509
commit
cfe9c55c9a
16 changed files with 131 additions and 7 deletions
13
js/game.mjs
13
js/game.mjs
|
@ -1,8 +1,9 @@
|
|||
import * as graphics from './graphics/index.mjs';
|
||||
import * as gui from './gui/index.mjs';
|
||||
|
||||
export let game;
|
||||
|
||||
export function init() {
|
||||
export async function init() {
|
||||
game = {
|
||||
state: {
|
||||
room: 'menu',
|
||||
|
@ -11,11 +12,15 @@ export function init() {
|
|||
};
|
||||
|
||||
graphics.init();
|
||||
gui.init();
|
||||
|
||||
tick();
|
||||
// Recursive `requestAnimationFrame` can cause problems with Parcel.
|
||||
while(true) {
|
||||
await tick();
|
||||
await new Promise(res => requestAnimationFrame(res));
|
||||
}
|
||||
}
|
||||
|
||||
function tick() {
|
||||
async function tick() {
|
||||
graphics.render();
|
||||
requestAnimationFrame(tick);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue