# HG changeset patch # User Jeremy Thurgood # Date 1283859330 -7200 # Node ID fda2b3a2f2e9bf583318ad634f4a6384698da7b5 # Parent ec855943f8988fc88bf016d0bafad84c842cf881 Remove drawing logic from State. diff -r ec855943f898 -r fda2b3a2f2e9 gamelib/gamescreen.py --- a/gamelib/gamescreen.py Tue Sep 07 10:12:55 2010 +0200 +++ b/gamelib/gamescreen.py Tue Sep 07 13:35:30 2010 +0200 @@ -69,6 +69,13 @@ def draw(self, surface): self.state.draw(surface, self.screen) + def draw(self, surface): + if self.state.previous_scene and self.state.do_check == constants.LEAVE: + # We still need to handle leave events, so still display the scene + self.state.previous_scene.draw(surface, self) + else: + self.state.current_scene.draw(surface, self) + def mouse_down(self, event): self.mouse_move(event) if event.button != 1: # We have a right/middle click @@ -159,7 +166,7 @@ overlay = scene_surface.convert_alpha() overlay.fill(Color(0, 0, 0, 191)) scene_surface.blit(overlay, (0, 0)) - self.state.draw_detail(surface.subsurface(self.image_rect), self.screen) + self.state.current_detail.draw(surface.subsurface(self.image_rect), self) def mouse_down(self, event): self.mouse_move(event) diff -r ec855943f898 -r fda2b3a2f2e9 gamelib/state.py --- a/gamelib/state.py Tue Sep 07 10:12:55 2010 +0200 +++ b/gamelib/state.py Tue Sep 07 13:35:30 2010 +0200 @@ -168,16 +168,6 @@ def set_tool(self, item): self.tool = item - def draw(self, surface, screen): - if self.do_check and self.previous_scene and self.do_check == constants.LEAVE: - # We still need to handle leave events, so still display the scene - self.previous_scene.draw(surface, screen) - else: - self.current_scene.draw(surface, screen) - - def draw_detail(self, surface, screen): - self.current_detail.draw(surface, screen) - def interact(self, pos): return self.current_scene.interact(self.tool, pos)