X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/blobdiff_plain/ccd80f6896303234addbb0f619335b6e59df7746..62d5191553d75c84d63ace49f6f5173a35773c88:/src/app/events.py diff --git a/src/app/events.py b/src/app/events.py index dd6ac47..8e13a85 100755 --- a/src/app/events.py +++ b/src/app/events.py @@ -1,6 +1,35 @@ -from pygame.locals import USEREVENT -TIMEOUT = USEREVENT + 1 -NOTEON = USEREVENT + 2 -NOTEOFF = USEREVENT + 3 -KEYDOWN = USEREVENT + 4 -KEYUP = USEREVENT + 5 +import pygame +from sys import modules + +events = ['TIMEOUT', 'NOTEON', 'NOTEOFF', 'NOTEEND', 'COLDOWN', 'COLUP', 'COLOVER'] +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