changeset 92:1e9da4893d51

Add size parameter to habitats
author Neil Muller <drnlmuller@gmail.com>
date Sun, 11 Sep 2011 19:09:50 +0200
parents ebd8f46cc553
children 8d073e402294
files mamba/engine.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mamba/engine.py	Sun Sep 11 19:05:20 2011 +0200
+++ b/mamba/engine.py	Sun Sep 11 19:09:50 2011 +0200
@@ -40,15 +40,17 @@
 
 class Habitat(object):
 
-    def __init__(self):
+    def __init__(self, size=SCREEN):
+        self.surface_size = size
         self.surface = None
-        self.container = Container(pygame.Rect((0, 0), SCREEN), root=True)
+        self.container = Container(pygame.Rect((0, 0), self.surface_size,
+            root=True))
 
     def on_enter(self):
         """Called when this becomes the current habitat."""
         # Create the surface here as flipping between editor and
         # other things kills pygame.display
-        self.surface = pygame.Surface(SCREEN)
+        self.surface = pygame.Surface(self.surface_size)
 
     def on_exit(self):
         """Called when this stops being the current habitat."""