# HG changeset patch # User Simon Cross # Date 1316297086 -7200 # Node ID 6c1d44c1245422380339f7ae55fd378624b650c1 # Parent b459652f8c276bda70d20c9766001a1fedd1b979 Make space and pause also pause. diff -r b459652f8c27 -r 6c1d44c12454 TODO.txt --- a/TODO.txt Sun Sep 18 00:01:04 2011 +0200 +++ b/TODO.txt Sun Sep 18 00:04:46 2011 +0200 @@ -9,7 +9,6 @@ - numpad keys - cursor * Give a 2 second pause to view the level before starting. -* Use spacebar and pause key as pause keys too * Don't pause forever while loading unofficial levels * For user levels, we can update the cache on level save, but that would require a more global cache. Maybe centralise this in diff -r b459652f8c27 -r 6c1d44c12454 mamba/widgets/game.py --- 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):