-
Notifications
You must be signed in to change notification settings - Fork 3
/
gainda.js
56 lines (52 loc) · 1.25 KB
/
gainda.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
(function(globalObj){
/*function that loads mofules*/
function loadmodules(modules){
for(i in modules){
load("fx:"+modules[i]+".js");
}
};
this.Gaint = {
"application":function(appname,modules){
/*private variable for returned object form this function*/
var requiredModules = [].concat(modules);
var HashMap = Java.type("java.util.HashMap");
return {
appName:appname,
init:function(){
loadmodules(requiredModules);
},
/*Keep updated*/
tiles: new HashMap(),
views: new HashMap(),
tile:function(options){
this.tiles.put(options.name,options.make());
},
getView:function(viename){
return this.views.get(viename);
},
/*Keep updated*/
view:function(options){
var me = this;
var viewDef = {
application:me,
tile:options.tile,
render:function(){
var app = this.application;
app.renderView(this);
},
make:options.make
};
this.views.put(options.name,viewDef)
return viewDef;
},
renderView:function(view){
var tile = this.tiles.get(view.tile);
//tile.getRoot();
tile.getRoot().children.removeAll();
tile.getRoot().children.add(view.make())
$STAGE.scene =tile;
}
};
}
}
})(this);