From: Simon Cross Date: Sun, 28 Feb 2016 16:12:00 +0000 (+0200) Subject: Base infrastructure for scenes. X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=e14b3fe596763b16ad52b0504e93012063c49f07;p=koperkapel.git Base infrastructure for scenes. --- 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))