changeset 630:a5f573002fb0 pyntnclick

Pass rect around (we're going to be doing this alot).
author Simon Cross <hodgestar+bzr@gmail.com>
date Sat, 11 Feb 2012 22:20:52 +0200
parents 660ef5793886
children 8b78fc07a862
files pyntnclick/gamescreen.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pyntnclick/gamescreen.py	Sat Feb 11 22:20:26 2012 +0200
+++ b/pyntnclick/gamescreen.py	Sat Feb 11 22:20:52 2012 +0200
@@ -63,11 +63,11 @@
 
 class StateWidget(Widget):
 
-    def __init__(self, rect):
-        Widget.__init__(self, Rect(0, 0, SCENE_SIZE[0], SCENE_SIZE[1]))
+    def __init__(self, rect, screen):
+        Widget.__init__(self, rect)
         self.screen = screen
         self.game = screen.game
-        self.detail = DetailWindow(screen)
+        self.detail = DetailWindow(rect, screen)
 
     def draw(self, surface):
         self.animate()
@@ -140,8 +140,8 @@
 
 
 class DetailWindow(Container):
-    def __init__(self, screen):
-        Container.__init__(self, Rect((0, 0) + screen.surface_size))
+    def __init__(self, rect, screen):
+        Container.__init__(self, rect)
         self.image_rect = None
         self.screen = screen
         self.game = screen.game
@@ -222,8 +222,9 @@
 
     def start_game(self):
         self._clear_all()
+        rect = Rect((0, 0) + self.surface_size)
         self.game = self.create_initial_state()
-        self.state_widget = StateWidget(self)
+        self.state_widget = StateWidget(rect, self)
         self.container.add(self.state_widget)
 
         # XXX: self.popup_menu = PopupMenu(self)