From e14b3fe596763b16ad52b0504e93012063c49f07 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sun, 28 Feb 2016 18:12:00 +0200 Subject: [PATCH] Base infrastructure for scenes. --- koperkapel/pgzapp.py | 12 ++++++++++++ koperkapel/scenes/__init__.py | 0 koperkapel/scenes/base.py | 11 +++++++++++ koperkapel/scenes/menu.py | 10 ++++++++++ 4 files changed, 33 insertions(+) create mode 100644 koperkapel/scenes/__init__.py create mode 100644 koperkapel/scenes/base.py create mode 100644 koperkapel/scenes/menu.py diff --git a/koperkapel/pgzapp.py b/koperkapel/pgzapp.py index 225dde9..d703aaf 100644 --- a/koperkapel/pgzapp.py +++ b/koperkapel/pgzapp.py @@ -3,3 +3,15 @@ TITLE = "Koperkapel" WIDTH = 1024 HEIGHT = 768 + +from .scenes import menu + +current_scene = menu.MenuScene() + + +def update(dt): + current_scene.update(dt) + + +def draw(): + current_scene.draw(screen) diff --git a/koperkapel/scenes/__init__.py b/koperkapel/scenes/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/koperkapel/scenes/base.py b/koperkapel/scenes/base.py new file mode 100644 index 0000000..6bb7f55 --- /dev/null +++ b/koperkapel/scenes/base.py @@ -0,0 +1,11 @@ +""" Scene utilities. """ + + +class Scene: + """ Base class for scenes. """ + + def update(self, dt): + pass + + def draw(self, screen): + pass diff --git a/koperkapel/scenes/menu.py b/koperkapel/scenes/menu.py new file mode 100644 index 0000000..b646be0 --- /dev/null +++ b/koperkapel/scenes/menu.py @@ -0,0 +1,10 @@ +""" Mani menu scene. """ + +from .base import Scene + + +class MenuScene(Scene): + """ Main menu scene. """ + + def draw(self, screen): + screen.draw.text("Main menu", (300, 300)) -- 2.34.1