diff mamba/widgets/game.py @ 506:6c1d44c12454

Make space and pause also pause.
author Simon Cross <hodgestar@gmail.com>
date Sun, 18 Sep 2011 00:04:46 +0200
parents 30ce046d08c3
children
line wrap: on
line diff
--- a/mamba/widgets/game.py	Sun Sep 18 00:01:04 2011 +0200
+++ b/mamba/widgets/game.py	Sun Sep 18 00:04:46 2011 +0200
@@ -1,7 +1,8 @@
 """Display the game area."""
 
 from pygame.rect import Rect
-from pygame.locals import KEYDOWN, K_LEFT, K_RIGHT, K_DOWN, K_UP, K_p
+from pygame.locals import (KEYDOWN, K_LEFT, K_RIGHT, K_DOWN, K_UP, K_p,
+                           K_SPACE, K_PAUSE)
 
 from mamba.constants import UP, DOWN, LEFT, RIGHT
 from mamba.widgets.base import Widget
@@ -20,11 +21,14 @@
 
     def create_action_map(self):
         actions = {}
+        pause = (self.world.toggle_pause, ())
         actions[K_LEFT] = (self.world.snake.send_new_direction, (LEFT,))
         actions[K_RIGHT] = (self.world.snake.send_new_direction, (RIGHT,))
         actions[K_DOWN] = (self.world.snake.send_new_direction, (DOWN,))
         actions[K_UP] = (self.world.snake.send_new_direction, (UP,))
-        actions[K_p] = (self.world.toggle_pause, ())
+        actions[K_p] = pause
+        actions[K_SPACE] = pause
+        actions[K_PAUSE] = pause
         return actions
 
     def action_callback(self, ev, widget):