comparison nodejs/mbapp.js @ 820:7875e8026e86

Change the key from up/down to left/right
author wycc
date Fri, 10 Sep 2010 08:33:07 +0800
parents 37a1bd3e3ce1
children 586e50f82c1f
comparison
equal deleted inserted replaced
814:a7c337533f49 820:7875e8026e86
28 app.prototype.loadSVG=function(fname) { 28 app.prototype.loadSVG=function(fname) {
29 svg.loadSVG(this.mb_rt,this.mb_rt.root,fname); 29 svg.loadSVG(this.mb_rt,this.mb_rt.root,fname);
30 } 30 }
31 31
32 app.prototype.KeyPress = function(evt) { 32 app.prototype.KeyPress = function(evt) {
33 sys.puts(evt.sym);
33 if (this.onKeyPress) this.onKeyPress(evt.sym); 34 if (this.onKeyPress) this.onKeyPress(evt.sym);
34 if (evt.sym in this.keymap) this.keymap[evt.sym](); 35 if (evt.sym in this.keymap) this.keymap[evt.sym]();
35 } 36 }
36 37
37 app.prototype.loop=function() { 38 app.prototype.loop=function() {
67 } 68 }
68 69
69 exports.app=app; 70 exports.app=app;
70 71
71 // Put all key definition here 72 // Put all key definition here
73 exports.KEY_LEFT = 0xff51;
72 exports.KEY_UP = 0xff52; 74 exports.KEY_UP = 0xff52;
75 exports.KEY_RIGHT = 0xff53;
73 exports.KEY_DOWN = 0xff54; 76 exports.KEY_DOWN = 0xff54;
77 exports.KEY_ENTER = 0xff0d;
74 exports.EVT_ANY=0; 78 exports.EVT_ANY=0;
75 exports.EVT_MOUSE_OVER=1; 79 exports.EVT_MOUSE_OVER=1;
76 exports.EVT_MOUSE_OUT=2; 80 exports.EVT_MOUSE_OUT=2;
77 exports.EVT_MOUSE_MOVE=3; 81 exports.EVT_MOUSE_MOVE=3;
78 exports.EVT_MOUSE_BUT_PRESS4; 82 exports.EVT_MOUSE_BUT_PRESS4;