[gnome-games/gsoc-seed-games] [lightsoff] Use Clutter keysyms (surprise! they're in the GIR, toplevel)
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/gsoc-seed-games] [lightsoff] Use Clutter keysyms (surprise! they're in the GIR, toplevel)
- Date: Thu, 2 Jul 2009 04:59:57 +0000 (UTC)
commit 8c620e3f2ad76b71eeae4a3a405f4eff06f9242f
Author: Tim Horton <hortont svn gnome org>
Date: Thu Jul 2 00:59:21 2009 -0400
[lightsoff] Use Clutter keysyms (surprise! they're in the GIR, toplevel)
lightsoff/src/Game.js | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/lightsoff/src/Game.js b/lightsoff/src/Game.js
index 5f6834c..4007db1 100644
--- a/lightsoff/src/Game.js
+++ b/lightsoff/src/Game.js
@@ -181,10 +181,7 @@ GameView = new GType({
// Change the currently selected tile with the keyboard
this.update_keyboard_selection = function (actor, event, ud)
{
- // TODO: this is wrong. but, they're defines...
- var kUp = 65362, kDown = 65364, kLeft = 65361, kRight = 65363, kEnter = 65293, kEsc = 65307;
-
- if(event.key.keyval == kEsc)
+ if(event.key.keyval == Clutter.Escape)
{
keycursor_view.animate(Clutter.AnimationMode.EASE_OUT_SINE, 250,
{
@@ -196,22 +193,22 @@ GameView = new GType({
if(keycursor.ready)
{
- if(event.key.keyval == kUp && keycursor.y > 0)
+ if(event.key.keyval == Clutter.Up && keycursor.y > 0)
keycursor.y--;
- else if(event.key.keyval == kDown && keycursor.y < 4)
+ else if(event.key.keyval == Clutter.Down && keycursor.y < 4)
keycursor.y++;
- else if(event.key.keyval == kLeft && keycursor.x > 0)
+ else if(event.key.keyval == Clutter.Left && keycursor.x > 0)
keycursor.x--;
- else if(event.key.keyval == kRight && keycursor.x < 4)
+ else if(event.key.keyval == Clutter.Right && keycursor.x < 4)
keycursor.x++;
- else if(event.key.keyval == kEnter)
+ else if(event.key.keyval == Clutter.Return)
board_view.light_toggle(keycursor.x, keycursor.y);
}
- if(event.key.keyval != kDown &&
- event.key.keyval != kUp &&
- event.key.keyval != kLeft &&
- event.key.keyval != kRight)
+ if(event.key.keyval != Clutter.Down &&
+ event.key.keyval != Clutter.Up &&
+ event.key.keyval != Clutter.Left &&
+ event.key.keyval != Clutter.Right)
return false;
var loc = board_view.position_for_light(keycursor.x, keycursor.y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]