changeset 820:7875e8026e86

Change the key from up/down to left/right
author wycc
date Fri, 10 Sep 2010 08:33:07 +0800
parents a7c337533f49
children bfdc82bbd6e4
files nodejs/mbapp.js nodejs/testdesktop.js
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/nodejs/mbapp.js	Fri Sep 10 00:11:38 2010 +0800
+++ b/nodejs/mbapp.js	Fri Sep 10 08:33:07 2010 +0800
@@ -30,6 +30,7 @@
 }
 
 app.prototype.KeyPress = function(evt) {
+    sys.puts(evt.sym);
     if (this.onKeyPress) this.onKeyPress(evt.sym);
 	if (evt.sym in this.keymap) this.keymap[evt.sym]();
 }
@@ -69,8 +70,11 @@
 exports.app=app;
 
 // Put all key definition here
+exports.KEY_LEFT = 0xff51;
 exports.KEY_UP = 0xff52;
+exports.KEY_RIGHT = 0xff53;
 exports.KEY_DOWN = 0xff54;
+exports.KEY_ENTER = 0xff0d;
 exports.EVT_ANY=0;
 exports.EVT_MOUSE_OVER=1;
 exports.EVT_MOUSE_OUT=2;
--- a/nodejs/testdesktop.js	Fri Sep 10 00:11:38 2010 +0800
+++ b/nodejs/testdesktop.js	Fri Sep 10 08:33:07 2010 +0800
@@ -16,8 +16,11 @@
 item = 0;
 an = new animate.scale(app,items[item],1,1.5,0.1);
 an.start();
+setInterval(function() {
+    
 
-app.addKeyListener(mbapp.KEY_UP, function() {
+}, 300);
+app.addKeyListener(mbapp.KEY_LEFT, function() {
 	var old = items[item];
 	item = item - 1;
 	if (item == -1) {
@@ -31,7 +34,7 @@
     an.start();
 });
 
-app.addKeyListener(mbapp.KEY_DOWN, function() {
+app.addKeyListener(mbapp.KEY_RIGHT, function() {
 	var old = items[item];
 	item = item + 1;
 	if (item == items.length) {