From 4eeaab6b382ed8a09ce03905acacb1752bef7954 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sun, 11 May 2014 16:53:23 +0200 Subject: [PATCH] At skeletal menu scene. --- naja/__main__.py | 4 +++- naja/engine.py | 4 +++- naja/scenes/menu.py | 11 +++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 naja/scenes/menu.py diff --git a/naja/__main__.py b/naja/__main__.py index 9beb26c..0bf9c50 100644 --- a/naja/__main__.py +++ b/naja/__main__.py @@ -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() diff --git a/naja/engine.py b/naja/engine.py index d509ec2..fc58f18 100644 --- a/naja/engine.py +++ b/naja/engine.py @@ -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 index 0000000..27b7e9c --- /dev/null +++ b/naja/scenes/menu.py @@ -0,0 +1,11 @@ +""" +Main menu scene. +""" + +from .scene import Scene + + +class MenuScene(Scene): + """ + Main menu. + """ -- 2.34.1