5 import pygame.event as pge
6 import pygame.locals as pgl
9 def finish_event(handled=True, skip_invalidate=False):
10 if not skip_invalidate:
11 InvalidateTheWorld.post()
15 class NajaEvent(object):
19 def post(cls, **attributes):
20 event = pge.Event(pgl.USEREVENT, naja_event_type=cls.TYPE,
26 return ev.type == pgl.USEREVENT and ev.naja_event_type == cls.TYPE
29 class SceneChangeEvent(NajaEvent):
33 def post(cls, scene_cls):
34 super(SceneChangeEvent, cls).post(scene_cls=scene_cls)
37 class QuitGameEvent(NajaEvent):
41 class InvalidateTheWorld(NajaEvent):
42 # This is used to signal to all the widgets that the world has changed
43 # and cached state may need to be recreated
47 class SelectEvent(NajaEvent):