source: nagslang/engine.py@ 18:9ecb1d222ee0

Last change on this file since 18:9ecb1d222ee0 was 18:9ecb1d222ee0, checked in by Simon Cross <hodgestar@…>, 8 years ago

Screens.

File size: 753 bytes
Line 
1"""Top-level event dispatching and area transition."""
2
3import pygame
4
5from nagslang import constants
6from nagslang.screens.menu import MenuScreen
7
8
9class Engine(object):
10 def __init__(self, surface):
11 self._surface = surface
12 self._clock = pygame.time.Clock()
13 self._fps = constants.FPS
14 self._current_area = MenuScreen()
15
16 def run(self):
17 running = True
18 while running:
19 for ev in pygame.event.get():
20 if ev.type == pygame.locals.QUIT:
21 running = False
22 else:
23 self._current_area.handle_event(ev)
24 self._current_area.render(self._surface)
25 pygame.display.flip()
26 self._clock.tick(self._fps)
Note: See TracBrowser for help on using the repository browser.