-
Notifications
You must be signed in to change notification settings - Fork 0
/
index-html.js
47 lines (39 loc) · 1.29 KB
/
index-html.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
/** INITIALIZATION **/
var canvas = document.getElementById('canvas');
canvas.height = 500;
canvas.width = 1000;
var ctx = canvas.getContext('2d');
var gz = {
height: canvas.height,
width: canvas.width,
update: true,
draw: true,
x: 0,
y: 0
}
if(true && window.devicePixelRatio) {
var hidefCanvasWidth = canvas.getAttribute('width');
var hidefCanvasHeight = canvas.getAttribute('height');
var hidefCanvasCssWidth = hidefCanvasWidth;
var hidefCanvasCssHeight = hidefCanvasHeight;
canvas.setAttribute('width', hidefCanvasWidth * window.devicePixelRatio);
canvas.setAttribute('height', hidefCanvasHeight * window.devicePixelRatio);
ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
gz.height = canvas.height / window.devicePixelRatio
gz.width = canvas.width / window.devicePixelRatio
console.log("retina activated")
}
window.requestAnimationFrame = function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame ||
function(f) {
window.setTimeout(f, 1e3 / 60);
}
}();
var Y = 20,
X = 2 * Y,
DEBUG = false,
showFPS = true;
// dummy GameCenter
var GameCenter = {}
GameCenter.reportScore = function() {};
GameCenter.authed = true;