source: nagslang/screens/menu.py@ 225:c8ead015c48e

Last change on this file since 225:c8ead015c48e was 180:026297a03963, checked in by Neil Muller <drnlmuller@…>, 8 years ago

Add DoorEvent and tweak ScreenChange to keep more state when the player goes through a door

File size: 669 bytes
Line 
1"""Display a menu screen."""
2
3import pygame
4
5from nagslang.screens.base import Screen
6from nagslang.events import QuitEvent, ScreenChange
7from nagslang.widgets.text import TextWidget
8
9
10class MenuScreen(Screen):
11
12 def handle_event(self, ev):
13 if ev.type == pygame.locals.KEYDOWN:
14 if ev.key == pygame.locals.K_ESCAPE:
15 QuitEvent.post()
16 elif ev.key == pygame.locals.K_1:
17 ScreenChange.post('level1', None)
18
19 def render(self, surface):
20 surface.fill(pygame.color.Color(255, 255, 255))
21 TextWidget((10, 10), 'Menu').draw(surface)
22 TextWidget((10, 30), 'Press 1 to start').draw(surface)
Note: See TracBrowser for help on using the repository browser.