X-Git-Url: https://svn.cri.ensmp.fr/git/minwii.git/blobdiff_plain/bf4fd0cf6bb79dffd32e4995f0b312fb1a32502f..cf0a97e6fca3155000772d961bba89c215e1b457:/src/app/events.py?ds=sidebyside diff --git a/src/app/events.py b/src/app/events.py index ae99ad5..eee6445 100755 --- a/src/app/events.py +++ b/src/app/events.py @@ -1,6 +1,43 @@ -from pygame.locals import USEREVENT -TIMEOUT = USEREVENT + 1 -NOTEON = USEREVENT + 2 -NOTEOFF = USEREVENT + 3 -COLDOWN = USEREVENT + 4 -COLUP = USEREVENT + 5 +import pygame +from sys import modules + +events = ['TIMEOUT', + 'NOTEON', + 'NOTEOFF', + 'NOTEEND', + 'COLDOWN', + 'COLUP', + 'COLOVER', + 'COLSTATECHANGE'] + +eventNames = {} +self = modules[__name__] + +for i, name in enumerate(events) : + eventType = pygame.USEREVENT+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