diff gamelib/gamescreen.py @ 515:fda2b3a2f2e9

Remove drawing logic from State.
author Jeremy Thurgood <firxen@gmail.com>
date Tue, 07 Sep 2010 13:35:30 +0200
parents b10dae40dc32
children 26f9b4d10e3e
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)