nommage des événements.
[minwii.git] / src / app / events.py
1 import pygame
2 from sys import modules
3
4 events = ['TIMEOUT', 'NOTEON', 'NOTEOFF', 'NOTEEND', 'COLDOWN', 'COLUP', 'COLOVER']
5 eventNames = {}
6 self = modules[__name__]
7
8 for i, name in enumerate(events) :
9 eventType = pygame.USEREVENT+i
10 eventNames[eventType] = name
11 setattr(self, name, eventType)
12
13 pygame_events = [
14 'NOEVENT',
15 'ACTIVEEVENT',
16 'KEYDOWN',
17 'KEYUP',
18 'MOUSEMOTION',
19 'MOUSEBUTTONDOWN',
20 'MOUSEBUTTONUP',
21 'JOYAXISMOTION',
22 'JOYBALLMOTION',
23 'JOYHATMOTION',
24 'JOYBUTTONDOWN',
25 'JOYBUTTONUP',
26 'VIDEORESIZE',
27 'VIDEOEXPOSE',
28 'QUIT',
29 'SYSWMEVENT',
30 'USEREVENT',
31 'NUMEVENTS'
32 ]
33
34 for name in pygame_events :
35 eventNames[getattr(pygame, name)] = name