Mercurial > MadButterfly
diff nodejs/mbapp.js @ 721:01d02382dea7
Refactory the mbapp and testsvg to use keyboard events
author | wycc |
---|---|
date | Sun, 15 Aug 2010 19:07:36 +0800 |
parents | 72abb4154936 |
children | 503f3d18248e |
line wrap: on
line diff
--- a/nodejs/mbapp.js Sun Aug 15 01:44:38 2010 +0800 +++ b/nodejs/mbapp.js Sun Aug 15 19:07:36 2010 +0800 @@ -9,15 +9,24 @@ app=function() { this.mb_rt = mb_rt; - } app.prototype.loadSVG=function(fname) { - svg.loadSVG(mb_rt,mb_rt.root,fname); + svg.loadSVG(this.mb_rt,this.mb_rt.root,fname); } app.prototype.loop=function() { - mb_rt.redraw_all(); - mb_rt.flush(); + this.mb_rt.redraw_all(); + this.mb_rt.flush(); +} +app.prototype.get=function(name) { + return this.mb_rt.mbnames[name]; +} +app.prototype.addKeyboardListener=function(type,f) { + return this.mb_rt.kbevents.add_event_observer(type,f); } exports.app=app; + +// Put all key definition here +exports.KEY_UP=111; +exports.KEY_DOWN=116;