X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/8e4a9825b3464ea2600eb193151b03f903aed5f4..baf4f2fe0e04d6b95c428813dd920b597031ec04:/src/app/events.py?ds=sidebyside diff --git a/src/app/events.py b/src/app/events.py index 149c2ff..6b90d92 100755 --- a/src/app/events.py +++ b/src/app/events.py @@ -1,4 +1,45 @@ -from pygame.locals import USEREVENT -TIMEOUT = USEREVENT + 1 -NOTEON = USEREVENT + 2 -NOTEOFF = USEREVENT + 3 +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 + +eventCodes = dict([v, k] for k, v in eventNames.items())