diff gamelib/gamescreen.py @ 517:26f9b4d10e3e

Remove mouse motion logic from GameState.
author Jeremy Thurgood <firxen@gmail.com>
date Tue, 07 Sep 2010 13:45:07 +0200
parents fda2b3a2f2e9
children 8f3c82c685a4
line wrap: on
line diff
--- a/gamelib/gamescreen.py	Tue Sep 07 13:37:00 2010 +0200
+++ b/gamelib/gamescreen.py	Tue Sep 07 13:45:07 2010 +0200
@@ -10,7 +10,7 @@
 from pygame.color import Color
 from pygame.locals import BLEND_ADD
 
-from constants import SCREEN, BUTTON_SIZE, SCENE_SIZE
+from constants import SCREEN, BUTTON_SIZE, SCENE_SIZE, LEAVE
 from cursor import CursorWidget
 from state import initial_state, handle_result
 from widgets import (MessageDialog, BoomButton, HandButton, PopupMenu,
@@ -70,7 +70,7 @@
         self.state.draw(surface, self.screen)
 
     def draw(self, surface):
-        if self.state.previous_scene and self.state.do_check == constants.LEAVE:
+        if self.state.previous_scene and self.state.do_check == LEAVE:
             # We still need to handle leave events, so still display the scene
             self.state.previous_scene.draw(surface, self)
         else:
@@ -103,7 +103,8 @@
 
     def _mouse_move(self, pos):
         self.state.highlight_override = False
-        self.state.mouse_move(pos)
+        self.state.current_scene.mouse_move(pos)
+        self.state.old_pos = pos
 
     def show_message(self, message, style=None):
         # Display the message as a modal dialog
@@ -181,7 +182,7 @@
 
     def _mouse_move(self, pos):
         self.state.highlight_override = False
-        self.state.mouse_move_detail(self.global_to_local(pos))
+        self.state.current_detail.mouse_move(self.global_to_local(pos))
 
     def show_message(self, message, style=None):
         self.parent.show_message(message, style)