X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/blobdiff_plain/30e36fe2e442924342ce39d3217002ff0d222f35..f439fefd7ee0b44442268443f2fefb3d33a47fb8:/src/app/events.py diff --git a/src/app/events.py b/src/app/events.py index 02444b0..8e13a85 100755 --- a/src/app/events.py +++ b/src/app/events.py @@ -1,8 +1,35 @@ -from pygame.locals import USEREVENT -TIMEOUT = USEREVENT + 1 -NOTEON = USEREVENT + 2 -NOTEOFF = USEREVENT + 3 -NOTEEND = USEREVENT + 4 -COLDOWN = USEREVENT + 5 -COLUP = USEREVENT + 6 -COLOVER = USEREVENT + 7 \ No newline at end of file +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