Mercurial > mamba
annotate mamba/engine.py @ 12:0196455fa432
Minimal event loop.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sun, 11 Sep 2011 13:11:52 +0200 |
parents | 621a04bf1feb |
children | f5846a46e9c5 |
rev | line source |
---|---|
12 | 1 """Game engine and top-level game loop.""" |
2 | |
3 import pygame.event | |
4 import pygame.display | |
5 from pygame.locals import QUIT | |
6 | |
7 | |
8 class Engine(object): | |
9 def __init__(self): | |
10 pass | |
11 | |
12 def run(self): | |
13 """Game loop.""" | |
14 get_events = pygame.event.get | |
15 flip = pygame.display.flip | |
16 while True: | |
17 events = get_events() | |
18 for ev in events: | |
19 if ev.type is QUIT: | |
20 return | |
21 flip() |