X-Git-Url: https://svn.cri.ensmp.fr/git/minwii.git/blobdiff_plain/7fa3a2ce5331c49d0df4ae103abc193e682d48cf..8a421d33328f7dd6d6bff38cc04f53cdf25de3a9:/src/app/events.py diff --git a/src/app/events.py b/src/app/events.py index b271c1f..a67a416 100755 --- a/src/app/events.py +++ b/src/app/events.py @@ -1,2 +1,44 @@ -from pygame.locals import USEREVENT -TIMEOUT = USEREVENT + 1 +import pygame +from sys import modules + +events = ['NOTEON', + 'NOTEOFF', + 'NOTEEND', + 'COLDOWN', + 'COLUP', + 'COLOVER', + 'COLSTATECHANGE'] + +eventNames = {} +self = modules[__name__] + +for i, name in enumerate(events) : + eventType = pygame.USEREVENT + 1 + i + eventNames[eventType] = name + setattr(self, name, eventType) + +pygame_events = [ + 'NOEVENT', + 'ACTIVEEVENT', + 'KEYDOWN', + 'KEYUP', + 'MOUSEMOTION', + 'MOUSEBUTTONDOWN', + 'MOUSEBUTTONUP', + 'JOYAXISMOTION', + 'JOYBALLMOTION', + 'JOYHATMOTION', + 'JOYBUTTONDOWN', + 'JOYBUTTONUP', + 'VIDEORESIZE', + 'VIDEOEXPOSE', + 'QUIT', + 'SYSWMEVENT', + 'USEREVENT', + 'NUMEVENTS' + ] + +for name in pygame_events : + eventNames[getattr(pygame, name)] = name + +eventCodes = dict([v, k] for k, v in eventNames.items())