class Engine(object):
- def __init__(self, screen, scene):
+ def __init__(self, screen, gamestate):
self._screen = screen
+ self._gamestate = gamestate
+ self._scene = None
+
+ def set_scene(self, scene):
+ if self._scene is not None:
+ self._scene.exit(self._gamestate)
self._scene = scene
+ self._scene.enter(self._gamestate)
def run(self):
clock = pygame.time.Clock()
if ev.type == pgl.QUIT:
return
else:
- pass # TODO: send to scene
+ self._scene.event(ev, self._gamestate)
- # TODO: render scene
+ self._scene.render(self._screen, self._gamestate)
pygame.display.flip()
clock.tick(FPS)