comparison nodejs/mbapp.js @ 873:881efcd8a18f abs_n_rel_center

Merge from default branch
author Thinker K.F. Li <thinker@codemud.net>
date Fri, 24 Sep 2010 16:06:42 +0800
parents eff2f580b536 bcc63b20d5c6
children ec8d7e9c9642
comparison
equal deleted inserted replaced
862:3ce9daa9558b 873:881efcd8a18f
136 this.keymap[k] = f; 136 this.keymap[k] = f;
137 } 137 }
138 } 138 }
139 } 139 }
140 140
141 var app_with_win = function(display, win) {
142 var self = this;
143 var mb_rt;
144 var background;
145 var paint;
146
147 if(typeof display == "undefined" || typeof win == "undefined")
148 throw "Invalid argument";
149
150 mb_rt = this.mb_rt = new mbfly.mb_rt_with_win(display, win);
151 background = mb_rt.rect_new(0, 0, 720, 480, 0, 0);
152 paint = mb_rt.paint_color_new(1, 1, 1, 1);
153 paint.fill(background);
154 mb_rt.root.add_shape(background);
155
156 this.mb_rt.kbevents.
157 add_event_observer(exports.EVT_KB_PRESS,
158 function(evt) { self.KeyPress(evt); });
159 this.keymap = {};
160 this.onKeyPress = null;
161 }
162
163 app_with_win.prototype = app.prototype;
164
141 exports.app=app; 165 exports.app=app;
166 exports.app_with_win = app_with_win;
142 167
143 // Put all key definition here 168 // Put all key definition here
144 exports.KEY_LEFT = 0xff51; 169 exports.KEY_LEFT = 0xff51;
145 exports.KEY_UP = 0xff52; 170 exports.KEY_UP = 0xff52;
146 exports.KEY_RIGHT = 0xff53; 171 exports.KEY_RIGHT = 0xff53;