# HG changeset patch # User Jeremy Thurgood # Date 1283859907 -7200 # Node ID 26f9b4d10e3ea93250358eaa3c4277b7713607ea # Parent ac2b19f052532fbe8a678639cacc07723eb4598c Remove mouse motion logic from GameState. diff -r ac2b19f05253 -r 26f9b4d10e3e gamelib/gamescreen.py --- 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) diff -r ac2b19f05253 -r 26f9b4d10e3e gamelib/state.py --- a/gamelib/state.py Tue Sep 07 13:37:00 2010 +0200 +++ b/gamelib/state.py Tue Sep 07 13:45:07 2010 +0200 @@ -208,18 +208,10 @@ return self.current_scene.enter() raise RuntimeError('invalid do_check value %s' % self.do_check) - def mouse_move(self, pos): - self.current_scene.mouse_move(pos) - # So we can do sensible things on enter and leave - self.old_pos = pos - def set_do_enter_leave(self): """Flag that we need to run the enter loop""" self.do_check = constants.LEAVE - def mouse_move_detail(self, pos): - self.current_detail.mouse_move(pos) - class StatefulGizmo(object):