Mercurial > MadButterfly
diff 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 |
line wrap: on
line diff
--- a/nodejs/mbapp.js Tue Sep 21 00:40:36 2010 +0800 +++ b/nodejs/mbapp.js Fri Sep 24 16:06:42 2010 +0800 @@ -138,7 +138,32 @@ } } +var app_with_win = function(display, win) { + var self = this; + var mb_rt; + var background; + var paint; + + if(typeof display == "undefined" || typeof win == "undefined") + throw "Invalid argument"; + + mb_rt = this.mb_rt = new mbfly.mb_rt_with_win(display, win); + background = mb_rt.rect_new(0, 0, 720, 480, 0, 0); + paint = mb_rt.paint_color_new(1, 1, 1, 1); + paint.fill(background); + mb_rt.root.add_shape(background); + + this.mb_rt.kbevents. + add_event_observer(exports.EVT_KB_PRESS, + function(evt) { self.KeyPress(evt); }); + this.keymap = {}; + this.onKeyPress = null; +} + +app_with_win.prototype = app.prototype; + exports.app=app; +exports.app_with_win = app_with_win; // Put all key definition here exports.KEY_LEFT = 0xff51;