From b98321df7dc7747a062e69a14278939685e399a1 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sun, 28 Feb 2016 23:38:17 +0200 Subject: [PATCH] Add quit event. --- koperkapel/scenes/base.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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. """ -- 2.34.1