-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
46 lines (38 loc) · 949 Bytes
/
main.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
37
38
39
40
41
42
43
44
45
46
// TODO: find a place for all this functions
function forEachIn(object, action) {
for (var property in object) {
if (object.hasOwnProperty(property))
action(property, object[property]);
}
}
function map(func, array) {
var result = [];
forEach(array, function (element) {
result.push(func(element));
});
return result;
}
function forEach(func, array) {
for(var i=0; i< array.length; i++)
func(array[i]);
};
// ---- END generic functions
(function() {
// require main
require(
['game/game'],
function(Game) {
var canvas = document.getElementById('canvas');
canvas.height = window.innerHeight;
canvas.width = window.innerWidth;
var game = new Game(canvas);
game.start();
// document.getElementById('stop').addEventListener('click', function(){
// game.stop();
// });
// document.getElementById('start').addEventListener('click', function(){
// game.start();
// });
}
);
})();