2 import pygame.locals as pgl
4 from naja.constants import FPS
5 from naja.events import SceneChangeEvent, QuitGameEvent
9 def __init__(self, surface, scene):
10 self._surface = surface
14 clock = pygame.time.Clock()
16 self._surface.fill((0, 0, 0))
17 for ev in pygame.event.get():
18 if ev.type == pgl.QUIT or QuitGameEvent.matches(ev):
21 elif SceneChangeEvent.matches(ev):
22 self.change_scene(ev.scene)
24 self._scene.handle_event(ev)
25 self._scene.render(self._surface)
29 def change_scene(self, scene):