From: Simon Cross Date: Sun, 28 Feb 2016 21:38:17 +0000 (+0200) Subject: Add quit event. X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=b98321df7dc7747a062e69a14278939685e399a1;p=koperkapel.git Add quit event. --- diff --git a/koperkapel/scenes/base.py b/koperkapel/scenes/base.py index b6d6ff9..58f3874 100644 --- a/koperkapel/scenes/base.py +++ b/koperkapel/scenes/base.py @@ -30,6 +30,10 @@ class Engine: self._scene = scene self._scene.enter() + def quit_game(self): + from pgzero.game import exit + exit() + @apply_events def update(self, dt): return self._scene.update(dt) @@ -77,6 +81,12 @@ class ChangeSceneEvent(Event): ENGINE_METHOD = "change_scene" +class QuitEvent(Event): + """ Quit the game. """ + + ENGINE_METHOD = "quit_game" + + class Actors: """ A list of actors. """