Mercurial > boomslang
changeset 515:fda2b3a2f2e9
Remove drawing logic from State.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Tue, 07 Sep 2010 13:35:30 +0200 |
parents | ec855943f898 |
children | ac2b19f05253 |
files | gamelib/gamescreen.py gamelib/state.py |
diffstat | 2 files changed, 8 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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)