Shorter hints, which mean more space for actions in the tutorial
[naja.git] / naja / scenes / scene.py
index c82427d565790299f5cab195958a84df635a46d3..4841ab5a628cb3a318ab0c947d1d537f9f0ee03b 100644 (file)
@@ -2,6 +2,8 @@
 Base Scene class.
 """
 
+from naja.widgets.base import Container
+
 
 class Scene(object):
     """
@@ -9,8 +11,12 @@ class Scene(object):
 
     E.g. Splash screen, game board, credits, win, lose.
     """
-    def __init__(self):
-        pass
+    def __init__(self, state):
+        self.state = state
+        self.container = Container()
+
+    def add(self, widget):
+        self.container.add(widget)
 
     def enter(self):
         pass
@@ -18,8 +24,17 @@ class Scene(object):
     def exit(self):
         pass
 
-    def render(self, surface):
+    def render_scene(self, surface):
         pass
 
+    def render(self, surface):
+        self.render_scene(surface)
+        self.container.render(surface)
+
     def handle_event(self, ev):
+        if self.container.handle_event(ev):
+            return
+        self.handle_scene_event(ev)
+
+    def handle_scene_event(ev):
         pass