Switch to rollup for bundling

This commit is contained in:
asraelite 2018-03-02 17:23:19 +00:00
parent fc8d282509
commit cfe9c55c9a
16 changed files with 131 additions and 7 deletions

View file

@ -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);
}