Mercurial > mamba
comparison mamba/engine.py @ 24:30d4f3e62bcf
Refactor widgets *again*, add container to Habitat
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sun, 11 Sep 2011 14:21:50 +0200 |
parents | 6d195a3a4557 |
children | b38411d253e3 |
comparison
equal
deleted
inserted
replaced
23:d0e8940df703 | 24:30d4f3e62bcf |
---|---|
1 """Game engine and top-level game loop.""" | 1 """Game engine and top-level game loop.""" |
2 | 2 |
3 from mamba.widgets.base import Container | |
3 import pygame.event | 4 import pygame.event |
4 import pygame.display | 5 import pygame.display |
5 from pygame.locals import QUIT, USEREVENT | 6 from pygame.locals import QUIT, USEREVENT |
6 | 7 |
7 | 8 |
26 self._habitat.draw(surface) | 27 self._habitat.draw(surface) |
27 flip() | 28 flip() |
28 | 29 |
29 | 30 |
30 class Habitat(object): | 31 class Habitat(object): |
32 | |
33 def __init__(self): | |
34 self.container = Container() | |
35 | |
31 def dispatch(self, ev): | 36 def dispatch(self, ev): |
32 pass | 37 self.container.event(ev) |
33 | 38 |
34 def draw(self, surface): | 39 def draw(self, surface): |
35 pass | 40 self.container.draw(ev) |
36 | 41 |
37 | 42 |
38 class UserEvent(object): | 43 class UserEvent(object): |
39 | 44 |
40 utype = "UNKNOWN" | 45 utype = "UNKNOWN" |