X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=tabakrolletjie%2Fscenes%2Fbase.py;h=566c325555190dd5c78ff3c9a813306f0ba76f9a;hb=e4293bddb43d45dd56ef54c798ebc55076c3d97a;hp=3b0f60a8ff1e019a615f211ec88d3f34aa6ba987;hpb=fc5270a33b3765154fb1e737414197e278eb1e52;p=tabakrolletjie.git diff --git a/tabakrolletjie/scenes/base.py b/tabakrolletjie/scenes/base.py index 3b0f60a..566c325 100644 --- a/tabakrolletjie/scenes/base.py +++ b/tabakrolletjie/scenes/base.py @@ -1,6 +1,26 @@ """ Base scene class. """ +from pygame.sprite import RenderUpdates +from ..cursor import Cursor + + class BaseScene(object): + def __init__(self): + self._cursor = Cursor() + self._cursor_group = RenderUpdates() + + def _set_cursor(self, name, transform=None): + self._cursor.activate(name, self._cursor_group, transform=transform) + + def _unset_cursor(self): + self._cursor.deactivate(self._cursor_group) + + def _draw_cursor(self, surface): + """Draw the cursor. Should be called at the end of the render + method by scenes that need it.""" + self._cursor_group.update() + self._cursor_group.draw(surface) + def enter(self, gamestate): """ Enter the scene. """ @@ -12,3 +32,6 @@ class BaseScene(object): def render(self, screen, gamestate): """ Render the scene. """ + + def tick(self, gamestate): + """ Update the world based on time """