bugfix : on ne loggait pas le bon état.
[minwii.git] / src / app / events.py
1 import pygame
2 from sys import modules
3
4 events = ['TIMEOUT',
5 'NOTEON',
6 'NOTEOFF',
7 'NOTEEND',
8 'COLDOWN',
9 'COLUP',
10 'COLOVER',
11 'COLSTATECHANGE']
12
13 eventNames = {}
14 self = modules[__name__]
15
16 for i, name in enumerate(events) :
17 eventType = pygame.USEREVENT+i
18 eventNames[eventType] = name
19 setattr(self, name, eventType)
20
21 pygame_events = [
22 'NOEVENT',
23 'ACTIVEEVENT',
24 'KEYDOWN',
25 'KEYUP',
26 'MOUSEMOTION',
27 'MOUSEBUTTONDOWN',
28 'MOUSEBUTTONUP',
29 'JOYAXISMOTION',
30 'JOYBALLMOTION',
31 'JOYHATMOTION',
32 'JOYBUTTONDOWN',
33 'JOYBUTTONUP',
34 'VIDEORESIZE',
35 'VIDEOEXPOSE',
36 'QUIT',
37 'SYSWMEVENT',
38 'USEREVENT',
39 'NUMEVENTS'
40 ]
41
42 for name in pygame_events :
43 eventNames[getattr(pygame, name)] = name
44
45 eventCodes = dict([v, k] for k, v in eventNames.items())