5 import pygame.event as pge
6 import pygame.locals as pgl
9 class NajaEvent(object):
14 def post(cls, **attributes):
15 event = pge.Event(pgl.USEREVENT, naja_event_type=cls.TYPE,
21 return ev.type == pgl.USEREVENT and ev.naja_event_type == cls.TYPE
24 class SceneChangeEvent(NajaEvent):
28 def post(cls, scene_cls):
29 super(SceneChangeEvent, cls).post(scene_cls=scene_cls)
32 class QuitGameEvent(NajaEvent):
37 super(QuitGameEvent, cls).post()
40 class InvalidateTheWorld(NajaEvent):
41 # This is used to signal to all the widgets that the world has changed
42 # and cached state may need to be recreated
47 super(InvalidateTheWorld, cls).post()