changeset 521:787eb032bf8a

Cursor hint for Ctrl-click move
author Neil Muller <drnlmuller@gmail.com>
date Fri, 27 Nov 2009 14:08:28 +0000
parents 3e19a7f5333e
children 6f41a565e910
files gamelib/gameboard.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/gameboard.py	Fri Nov 27 14:01:29 2009 +0000
+++ b/gamelib/gameboard.py	Fri Nov 27 14:08:28 2009 +0000
@@ -3,7 +3,7 @@
 import pygame
 from pygame.locals import MOUSEBUTTONDOWN, MOUSEMOTION, KEYDOWN, K_UP, K_DOWN, \
         K_LEFT, K_RIGHT, KMOD_SHIFT, K_0, K_1, K_2, K_3, K_4, K_5, K_6, K_7, \
-        K_8, K_9, KMOD_CTRL
+        K_8, K_9, KMOD_CTRL, KEYUP
 from pgu import gui
 
 import tiles
@@ -805,6 +805,14 @@
                  self.stored_selections[e.key] = self.selected_chickens[:]
              else:
                  self.restore_selection(self.stored_selections.get(e.key, []))
+        elif e.type == KEYDOWN:
+             mods = pygame.key.get_mods()
+             if mods & KMOD_CTRL and self.selected_tool == constants.TOOL_SELECT_CHICKENS and self.selected_chickens:
+                pygame.mouse.set_cursor(*cursors.cursors['chicken'])
+        elif e.type == KEYUP:
+             mods = pygame.key.get_mods()
+             if not (mods & KMOD_CTRL) and self.selected_tool == constants.TOOL_SELECT_CHICKENS:
+                pygame.mouse.set_cursor(*cursors.cursors['select'])
         return False
 
     def restore_selection(self, selection):