-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdr.js
More file actions
67 lines (49 loc) · 1.51 KB
/
dr.js
File metadata and controls
67 lines (49 loc) · 1.51 KB
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
//set main namespace
goog.provide('dr');
//get requirements
goog.require('lime.Director');
goog.require('lime.Scene');
goog.require('lime.Layer');
goog.require('lime.GlossyButton');
goog.require('lime.transitions.Dissolve');
goog.require('lib');
// components
goog.require('dr.Button');
// entrypoint
dr.start = function(){
dr.director = new lime.Director(document.body,1024,768);
dr.director.makeMobileWebAppCapable();
lib.loadjsfile("assets/ndollar.js");
var scene = new lime.Scene();
var layer = new lime.Layer().setPosition(512,0);
if(dr.isBrokenChrome()) layer.setRenderer(lime.Renderer.CANVAS);
var btn = dr.makeButton('Play').setPosition(400,400);
window.test = btn;
dr.setEvent(btn,'click',function() {
console.log("dasdsa");
});
layer.appendChild(btn);
scene.appendChild(layer);
dr.director.replaceScene(scene);
};
dr.makeButton = function(lbl) {
var btn = new dr.Button(lbl).setSize(300,90);
btn.clickStatus = "avail";
return btn;
};
dr.isBrokenChrome = function(){
return (/Chrome\/9\.0\.597/).test(goog.userAgent.getUserAgentString());
};
dr.setEvent = function(context,event,callback) {
goog.events.listen(context,event,function() {
if(this.clickStatus == "avail") {
this.clickStatus = "unavail";
lime.scheduleManager.callAfter(function() {
this.clickStatus = "avail";
},this,300);
callback();
}
});
};
//this is required for outside access after code is compiled in ADVANCED_COMPILATIONS mode
goog.exportSymbol('dr.start', dr.start);