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