From: Simon Cross Date: Sun, 28 Feb 2016 20:24:49 +0000 (+0200) Subject: Add a list of actors to scenes. X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=50da329cd7efb508bba7bcf0c08406eb770f93ad;p=koperkapel.git Add a list of actors to scenes. --- 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