From: Simon Cross Date: Sun, 11 May 2014 16:04:07 +0000 (+0200) Subject: Add quitting. X-Git-Tag: 0.1~415 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=1e797f12e1130f04cd736d63e46efc81ed971ce3;p=naja.git Add quitting. --- diff --git a/naja/scenes/menu.py b/naja/scenes/menu.py index c1fd5f8..822c87a 100644 --- a/naja/scenes/menu.py +++ b/naja/scenes/menu.py @@ -2,8 +2,11 @@ Main menu scene. """ +import pygame.locals as pgl + from naja.scenes.scene import Scene from naja.widgets.text import TextWidget +from naja.events import QuitGameEvent class MenuScene(Scene): @@ -14,4 +17,6 @@ class MenuScene(Scene): colour=(255, 255, 255))) def handle_event(self, ev): - pass + if ev.type == pgl.KEYUP and ev.key in (pgl.K_q, pgl.K_ESCAPE): + QuitGameEvent.post() + return