samples/Blokus: Support for flipping pieces through space key
authorJerome St-Louis <jerome@ecere.com>
Thu, 15 Nov 2012 07:34:04 +0000 (02:34 -0500)
committerJerome St-Louis <jerome@ecere.com>
Thu, 15 Nov 2012 07:34:04 +0000 (02:34 -0500)
samples/games/blokus/blokus.ec

index 7a0777e..42cb365 100644 (file)
@@ -700,8 +700,18 @@ class Blokus : Window
       return true;
    }
 
+   bool OnKeyDown(Key key, unichar ch)
+   {
+      chat.disabled = false;
+      return true;
+   }
+
    bool OnKeyHit(Key key, unichar ch)
    {
+      if(key == space)
+      {
+         OnRightButtonDown(drag.x - offset.x, drag.y - offset.y, 0);
+      }
       if(key == wheelDown || key == down || key == left || key == wheelUp || key == up || key == right)
       {
          Piece * piece = &pieces[selectedPiece];
@@ -710,7 +720,6 @@ class Blokus : Window
          int x = squareDragged.x, y = squareDragged.y;
          int w,h;
          bool isDown = key == wheelDown || key == right || key == down;
-         chat.disabled = false;
 
          if(isDown)
          {