forked from lufylegend/lufylegend.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPageProperty.js
executable file
·74 lines (74 loc) · 2.11 KB
/
PageProperty.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
74
/*
* PageProperty.js
**/
function trace(){
if(!LGlobal.traceDebug)return;
var t = document.getElementById("traceObject"),i;
if(trace.arguments.length > 0 && t == null){
t = document.createElement("div");
t.id = "traceObject";
t.style.position = "absolute";
t.style.top = (LGlobal.height + 20) + "px";
document.body.appendChild(t);
}
for(i=0; i < trace.arguments.length; i++){
t.innerHTML=t.innerHTML+trace.arguments[i] + "<br />";
}
}
function addChild(o){
LGlobal.stage.addChild(o);
}
function removeChild(o){
LGlobal.stage.removeChild(o);
}
function init(s,c,w,h,f,t){
LGlobal.speed = s;
var _f = function (){
if(LGlobal.canTouch && LGlobal.aspectRatio == LANDSCAPE && window.innerWidth < window.innerHeight){
LGlobal.horizontalError();
}else if(LGlobal.canTouch && LGlobal.aspectRatio == PORTRAIT && window.innerWidth > window.innerHeight){
LGlobal.verticalError();
}else{
f();
}
LGlobal.startTimer = (new Date()).getTime();
};
if(t != null && t == LEvent.INIT){
LGlobal.frameRate = setInterval(function(){LGlobal.onShow();}, s);
LGlobal.setCanvas(c,w,h);
_f();
}else{
LEvent.addEventListener(window,"load",function(){
LGlobal.frameRate = setInterval(function(){LGlobal.onShow();}, s);
LGlobal.setCanvas(c,w,h);
_f();
});
}
}
function base(d,b,a){
var p=null,o=d.constructor.prototype,h={};
if(d.constructor.name == "Object"){
console.warn( "When you use the extends. You must make a method like 'XX.prototype.xxx=function(){}'. but not 'XX.prototype={xxx:function(){}}'.");
}
for(p in o)h[p]=1;
for(p in b.prototype){
if(!h[p])o[p] = b.prototype[p];
o[p][SUPER] = b.prototype;
}
b.apply(d,a);
}
function getTimer(){
return (new Date()).getTime() - LGlobal.startTimer;
}
if (!Array.prototype.indexOf){
Array.prototype.indexOf = function(elt){
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
if (from < 0)from += len;
for (; from < len; from++){
if (from in this && this[from] === elt)return from;
}
return -1;
};
}