From 50da329cd7efb508bba7bcf0c08406eb770f93ad Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sun, 28 Feb 2016 22:24:49 +0200 Subject: [PATCH] Add a list of actors to scenes. --- koperkapel/scenes/base.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/koperkapel/scenes/base.py b/koperkapel/scenes/base.py index 9bad13c..b6d6ff9 100644 --- a/koperkapel/scenes/base.py +++ b/koperkapel/scenes/base.py @@ -77,9 +77,31 @@ class ChangeSceneEvent(Event): ENGINE_METHOD = "change_scene" +class Actors: + """ A list of actors. """ + + def __init__(self): + self._actors = [] + + def add(self, actor): + self._actors.append(actor) + return actor + + def remove(self, actor): + self._actors.remove(actor) + return actor + + def draw(self, screen): + for actor in self._actors: + actor.draw() # TODO: allow an option screen to be passed in + + class Scene: """ Base class for scenes. """ + def __init__(self): + self.actors = Actors() + def enter(self): pass @@ -90,7 +112,8 @@ class Scene: pass def draw(self, screen): - pass + screen.clear() + self.actors.draw(screen) def on_mouse_down(self, pos, button): pass -- 2.34.1