Ignore:
Timestamp:
09/01/13 13:18:11 (8 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Message:

Hook up area.

Location:
nagslang/screens
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r18 r20  
    11"""Display a game area."""
    22
     3import pygame
     4
    35from nagslang.screens.base import Screen
     6from nagslang.events import ScreenChange
    47
    58
    69class AreaScreen(Screen):
    710    def handle_event(self, ev):
    8         pass
     11        if ev.type == pygame.locals.KEYDOWN:
     12            if ev.key == pygame.locals.K_ESCAPE:
     13                ScreenChange.post('menu')
    914
    1015    def render(self, surface):
    11         pass
     16        surface.fill(pygame.color.Color(0, 0, 0))
  • nagslang/screens/base.py

    r18 r20  
    99    def __init__(self):
    1010        self.space = pymunk.Space()
     11
     12    def setup(self, world):
     13        """Perform setup based on the world state."""
     14        pass
     15
     16    def teardown(self):
     17        pass
    1118
    1219    def post_event(self, ev):
  • nagslang/screens/menu.py

    r19 r20  
    44
    55from nagslang.screens.base import Screen
    6 from nagslang.events import QuitEvent
     6from nagslang.events import QuitEvent, ScreenChange
    77
    88
     
    1010
    1111    def handle_event(self, ev):
    12         if (ev.type == pygame.locals.KEYDOWN
    13                 and ev.key == pygame.locals.K_ESCAPE):
    14             QuitEvent.post()
     12        if ev.type == pygame.locals.KEYDOWN:
     13            if ev.key == pygame.locals.K_ESCAPE:
     14                QuitEvent.post()
     15            elif ev.key == pygame.locals.K_1:
     16                ScreenChange.post('level1')
    1517
    1618    def render(self, surface):
Note: See TracChangeset for help on using the changeset viewer.