Mercurial > MadButterfly
changeset 729:299ed9319dc6
Use key symbols instead of keycodes.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 17 Aug 2010 10:36:36 +0800 |
parents | a843f147c995 |
children | e77ae2d23245 |
files | nodejs/mbapp.js nodejs/testsvg.js |
diffstat | 2 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/nodejs/mbapp.js Tue Aug 17 08:31:24 2010 +0800 +++ b/nodejs/mbapp.js Tue Aug 17 10:36:36 2010 +0800 @@ -32,8 +32,8 @@ exports.app=app; // Put all key definition here -exports.KEY_UP = 111; -exports.KEY_DOWN=116; +exports.KEY_UP = 0xff52; +exports.KEY_DOWN = 0xff54; exports.EVT_ANY=0; exports.EVT_MOUSE_OVER=1; exports.EVT_MOUSE_OUT=2;
--- a/nodejs/testsvg.js Tue Aug 17 08:31:24 2010 +0800 +++ b/nodejs/testsvg.js Tue Aug 17 10:36:36 2010 +0800 @@ -10,7 +10,7 @@ lightbar[5] = app.get("item"+item)[5]; app.addKeyboardListener(mbapp.EVT_KB_PRESS, function(evt) { - if (evt.keycode == mbapp.KEY_UP) { + if (evt.sym == mbapp.KEY_UP) { item = item - 1; if (item == 0) item = 1; else { @@ -18,7 +18,7 @@ var an = new animate.linear(app,lightbar,target[2],target[5],0.3); an.start(); } - } else if (evt.keycode == mbapp.KEY_DOWN) { + } else if (evt.sym == mbapp.KEY_DOWN) { item = item + 1; if (item == 10) { item = 9;