-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.js
36 lines (29 loc) · 904 Bytes
/
game.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function Game() {
var graphicsDevice;
this.onLoad = function() {
if(PLATFORM_PC) {
init();
return;
}
document.addEventListener("deviceready", init, true);
};
function init() {
var REF_WIDTH = 1280;
var REF_HEIGHT = 720;
var canvas = document.getElementById("canvas");
graphicsDevice = new GraphicsDevice(canvas, REF_WIDTH, REF_HEIGHT);
touchEventsManager.init(graphicsDevice, canvas);
ScreensManager.init();
ScreensManager.switchToNumberSelectionScreen();
setInterval(update, 33);
}
function update() {
ScreensManager.currentScreen.update(graphicsDevice);
touchEventsManager.update();
draw();
}
function draw() {
graphicsDevice.clearRect(0, 0, graphicsDevice.viewport.width, graphicsDevice.viewport.height);
ScreensManager.currentScreen.draw(graphicsDevice);
}
}