OSDN Git Service

add ui16be method
[flapp/flapp.git] / src / display.js
1 goog.provide('FlappDisplay');
2
3 goog.scope(function () {
4
5 /**
6  * @constructor
7  */
8 FlappDisplay = function() {
9     this.objs = {};
10     this.places = {};
11 };
12
13 FlappDisplay.prototype = {
14     set: function(depth, obj, place) {
15         if (obj) {
16             this.objs[depth] = obj;
17             if (place.matrix) {
18                 obj.matrix = place.matrix;
19             }
20             if (place.colorTransform) {
21                 obj.colorTransform = place.colorTransform;
22             }
23         }
24         this.places[depth] = place;
25     },
26     getObj: function(depth) {
27         return this.objs[depth];
28     },
29     getPlace: function(depth) {
30         return this.places[depth];
31     },
32     del: function(depth) {
33         delete this.objs[depth];
34         delete this.places[depth];
35     },
36     descSortedDepth: function() {
37         var depthList = new Array(this.objs.length);
38         var keys = Object.keys(this.objs);
39         return keys.sort(
40             function(a,b) { return (a>b)?-1:((a<b)?1:0); }
41         );
42     }
43 };
44
45 });