Ajout « Ah le petit vin blanc ».
[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
12 eventNames = {}
13 self = modules[__name__]
14
15 for i, name in enumerate(events) :
16 eventType = pygame.USEREVENT + 1 + i
17 eventNames[eventType] = name
18 setattr(self, name, eventType)
19
20 pygame_events = [
21 'NOEVENT',
22 'ACTIVEEVENT',
23 'KEYDOWN',
24 'KEYUP',
25 'MOUSEMOTION',
26 'MOUSEBUTTONDOWN',
27 'MOUSEBUTTONUP',
28 'JOYAXISMOTION',
29 'JOYBALLMOTION',
30 'JOYHATMOTION',
31 'JOYBUTTONDOWN',
32 'JOYBUTTONUP',
33 'VIDEORESIZE',
34 'VIDEOEXPOSE',
35 'QUIT',
36 'SYSWMEVENT',
37 'USEREVENT',
38 'NUMEVENTS'
39 ]
40
41 for name in pygame_events :
42 eventNames[getattr(pygame, name)] = name
43
44 eventCodes = dict([v, k] for k, v in eventNames.items())