32 lines
425 B
JavaScript
32 lines
425 B
JavaScript
let game, context;
|
|
|
|
document.addEventListener("deviceready", () => {
|
|
|
|
if (typeof StatusBar !== 'undefined') {
|
|
StatusBar.hide();
|
|
}
|
|
|
|
init();
|
|
loop();
|
|
|
|
}, false);
|
|
|
|
function init() {
|
|
|
|
let canvas = document.getElementById('canvas');
|
|
game = new Game(canvas);
|
|
|
|
}
|
|
|
|
function loop() {
|
|
|
|
// Manage physics
|
|
game.update();
|
|
|
|
// Do rendering
|
|
game.render();
|
|
|
|
requestAnimationFrame(loop);
|
|
}
|
|
|