--- /dev/null
+"""
+Custom Pygame events.
+"""
+
+import pygame.event as pge
+
+
+class NajaEvent(pge.Event):
+
+ TYPE = "UNKNOWN"
+
+ @classmethod
+ def post(cls, **attributes):
+ event = pge.Event(pge.USEREVENT, naja_event_type=cls.TYPE,
+ **attributes)
+ pge.post(event)
+
+ @classmethod
+ def matches(cls, ev):
+ return ev.type == pge.USEREVENT and ev.naja_event_type == cls.TYPE
+
+
+class SceneChangeEvent(NajaEvent):
+ TYPE = "SCENE_CHANGE"
+
+ @classmethod
+ def post(cls, scene):
+ super(SceneChangeEvent, cls).post(scene=scene)