-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
73 lines (62 loc) · 1.69 KB
/
config.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* Constants */
var c = {
"DEBUG" : false,
"WIDTH" : 960,
"HEIGHT" : 600,
"MOBILE" : navigator.userAgent.match(/Android|iPhone|iPad|iPod/i),
"GUID" : (function () {
function S4() {
return ("0000" + Math.floor(Math.random() * 0x10000).toString(16)).slice(-4);
};
return (
S4() + S4() + "-" +
S4() + "-" +
S4() + "-" +
S4() + "-" +
S4() + S4() + S4()
);
})()
};
// Helper to enable debug by setting a special hash in the URL.
if (document.location.hash === "#debug") {
c.DEBUG = true;
enableDebug(true);
}
window.addEventListener("hashchange", function onHashChange(e) {
var debug = (document.location.hash === "#debug");
enableDebug(debug);
c.__defineGetter__("DEBUG", function () {
return debug;
});
});
// Turn the `c` object into a hash of constants.
try {
Object.keys(c).forEach(function eachKey(key) {
if (typeof(c[key]) === "function") {
return;
}
c.__defineGetter__(
key,
(function getterFactory(value) {
return function returnValue() {
return value
};
})(c[key])
);
});
}
catch (e) {
// No getters? FAKE CONSTANTS!
}
// Game engine settings.
me.sys.gravity = 0;
//me.sys.dirtyRegion = true; // Be fast!
me.sys.preRender = true; // Be faster!
me.sys.useNativeAnimFrame = true; // Be fastest!
me.sys.stopOnAudioError = false;
function enableDebug(enable) {
me.debug.renderHitBox = enable;
//me.debug.renderCollisionMap = enable;
}
// Game states.
me.state.BLIPJOY = me.state.USER + 0;