At skeletal menu scene.
authorSimon Cross <hodgestar@gmail.com>
Sun, 11 May 2014 14:53:23 +0000 (16:53 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sun, 11 May 2014 14:53:23 +0000 (16:53 +0200)
naja/__main__.py
naja/engine.py
naja/scenes/menu.py [new file with mode: 0644]

index 9beb26c63957553e3e86b19ccc836b8eabf2bd1e..0bf9c505b277d97b720cf8ac305ac4d5c0b263da 100644 (file)
@@ -7,6 +7,7 @@ from naja.constants import SCREEN
 from naja.engine import Engine
 from naja.sound import sound
 from naja.options import parse_args
+from naja.scenes.menu import MenuScene
 
 
 def main():
@@ -20,5 +21,6 @@ def main():
     sound.init()
 
     screen = pygame.display.get_surface()
-    engine = Engine(screen)
+    scene = MenuScene()
+    engine = Engine(screen, scene)
     engine.run()
index d509ec20e2e914e958b172380c2f3842b8d6648c..fc58f18503ddcb0b67754da71d186bf639236a1c 100644 (file)
@@ -3,13 +3,15 @@ import pygame.locals as pgl
 
 
 class Engine(object):
-    def __init__(self, surface):
+    def __init__(self, surface, scene):
         self._surface = surface
+        self._scene = scene
 
     def run(self):
         while True:
             for ev in pygame.event.get():
                 if ev.type == pgl.QUIT:
                     return
+                self._scene.handle_event()
             # TODO: work
             pygame.display.flip()
diff --git a/naja/scenes/menu.py b/naja/scenes/menu.py
new file mode 100644 (file)
index 0000000..27b7e9c
--- /dev/null
@@ -0,0 +1,11 @@
+"""
+Main menu scene.
+"""
+
+from .scene import Scene
+
+
+class MenuScene(Scene):
+    """
+    Main menu.
+    """