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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
define.class(function(require, exports){
DaliApi = require('./dali_api')
var DaliLayer = exports
DaliLayer.GlobalId = 0
this.atConstructor = function(parent, width, height) {
this.object_type = 'DaliLayer'
var dali = DaliApi.dali;
this.id = ++DaliLayer.GlobalId;
this.dalilayer = new dali.Layer();
this.onstage = false;
var older = typeof(dali.ALPHA_FUNCTION_DEFAULT) === 'undefined';
var behavior = (older) ? "Dali::Layer::LAYER_2D" : "LAYER_2D";
this.dalilayer.behavior = behavior;
if (width && height)
this.dalilayer.size = [width, height, 0];
this.dalilayer.parentOrigin = dali.TOP_LEFT;
this.dalilayer.anchorPoint = dali.TOP_LEFT;
if (DaliApi.emitcode) {
console.log('DALICODE: var ' + this.name() + ' = new dali.Layer();');
console.log('DALICODE: ' + this.name() + '.behavior = "' + behavior + '"');
if (width && height)
console.log('DALICODE: ' + this.name() + '.size = [' + width + ', ' + height + ', 0];');
console.log('DALICODE: ' + this.name() + '.parentOrigin = dali.TOP_LEFT;');
console.log('DALICODE: ' + this.name() + '.anchorPoint = dali.TOP_LEFT;');
}
if (typeof parent === 'undefined')
parent = DaliApi.currentlayer;
if (parent) {
DaliApi.rootlayer.add(this);
}
}
this.add = function(actor) {
if (actor.dalilayer) {
this.dalilayer.add(actor.dalilayer)
}
else {
this.dalilayer.add(actor.daliactor)
}
if (DaliApi.emitcode) {
console.log('DALICODE: ' + this.name() + '.add(' + actor.name() + ');');
}
}
this.name = function() {
return 'dalilayer' + this.id;
}
this.inspect = function(depth) {
var obj = {dalilayer:this.id};
var util = require('util')
return util.inspect(obj, {depth: null});
}
});
|