-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathg.js
More file actions
33 lines (27 loc) · 911 Bytes
/
Copy pathg.js
File metadata and controls
33 lines (27 loc) · 911 Bytes
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
//set main namespace
goog.provide('g');
//get requirements
goog.require('goog.events.KeyCodes');
goog.require('goog.events.KeyHandler');
goog.require('lime.Director');
goog.require('g.Menu');
g.WIDTH = 800;
g.HEIGHT = 600;
g.d = null;
g.KeyboardState = {};
// entrypoint
g.start = function(){
lime.scheduleManager.setDisplayRate(1000 / 60);
g.d = new lime.Director(document.getElementById('game'),g.WIDTH,g.HEIGHT);
var menuScene = new g.Menu();
// set current scene active
g.d.replaceScene(menuScene);
goog.events.listen(document,[goog.events.EventType.KEYDOWN],function(e){
g.KeyboardState[e.keyCode] = true;
});
goog.events.listen(document,[goog.events.EventType.KEYUP],function(e){
g.KeyboardState[e.keyCode] = false;
});
};
//this is required for outside access after code is compiled in ADVANCED_COMPILATIONS mode
goog.exportSymbol('g.start', g.start);