Add quit event.
authorSimon Cross <hodgestar@gmail.com>
Sun, 28 Feb 2016 21:38:17 +0000 (23:38 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sun, 28 Feb 2016 21:38:17 +0000 (23:38 +0200)
koperkapel/scenes/base.py

index b6d6ff9bf86262a89345e0de38f8c0fadb162286..58f3874f204b87a874751d593f4360a785791a70 100644 (file)
@@ -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. """