From 4986d1d41239a54cd13b490ad72c3dc99793c8e8 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 8 Apr 2010 08:50:03 +0000 Subject: [PATCH] =?utf8?q?bidouille=20pour=20qu'il=20n'y=20ait=20pas=20de?= =?utf8?q?=20collisions=20de=20num=C3=A9ros=20d'=C3=A9v=C3=A9nements.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@125 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/app/events.py | 22 ++++++++++++++-------- src/pgu/gui/const.py | 24 +++++++++++++++--------- src/pywiiuse/__init__.py | 1 + src/pywiiuse/pygame_wiimote.py | 5 +++++ 4 files changed, 35 insertions(+), 17 deletions(-) create mode 100755 src/pywiiuse/__init__.py diff --git a/src/app/events.py b/src/app/events.py index 02444b0..c27e951 100755 --- a/src/app/events.py +++ b/src/app/events.py @@ -1,8 +1,14 @@ -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 +base = pygame.USEREVENT +print 'events base :', pygame.USEREVENT +TIMEOUT = base + 1 +NOTEON = base + 2 +NOTEOFF = base + 3 +NOTEEND = base + 4 +COLDOWN = base + 5 +COLUP = base + 6 +COLOVER = base + 7 + +pygame.USEREVENT = COLOVER +if pygame.USEREVENT > pygame.NUMEVENTS : + pygame.NUMEVENTS = pygame.USEREVENT diff --git a/src/pgu/gui/const.py b/src/pgu/gui/const.py index c865cd8..d11a02d 100644 --- a/src/pgu/gui/const.py +++ b/src/pgu/gui/const.py @@ -32,14 +32,20 @@ import pygame from pygame.locals import QUIT, MOUSEBUTTONDOWN, MOUSEBUTTONUP, MOUSEMOTION, KEYDOWN, USEREVENT -ENTER = pygame.locals.USEREVENT + 0 -EXIT = pygame.locals.USEREVENT + 1 -BLUR = pygame.locals.USEREVENT + 2 -FOCUS = pygame.locals.USEREVENT + 3 -CLICK = pygame.locals.USEREVENT + 4 -CHANGE = pygame.locals.USEREVENT + 5 -OPEN = pygame.locals.USEREVENT + 6 -CLOSE = pygame.locals.USEREVENT + 7 -INIT = 'init' +base = pygame.USEREVENT +print 'pgu base:', base +ENTER = base + 0 +EXIT = base + 1 +BLUR = base + 2 +FOCUS = base + 3 +CLICK = base + 4 +CHANGE = base + 5 +OPEN = base + 6 +CLOSE = base + 7 +INIT = 'init' + +pygame.USEREVENT = CLOSE +if pygame.USEREVENT > pygame.NUMEVENTS : + pygame.NUMEVENTS = pygame.USEREVENT class NOATTR: pass \ No newline at end of file diff --git a/src/pywiiuse/__init__.py b/src/pywiiuse/__init__.py new file mode 100755 index 0000000..4287ca8 --- /dev/null +++ b/src/pywiiuse/__init__.py @@ -0,0 +1 @@ +# \ No newline at end of file diff --git a/src/pywiiuse/pygame_wiimote.py b/src/pywiiuse/pygame_wiimote.py index 5540430..26d9f9d 100755 --- a/src/pywiiuse/pygame_wiimote.py +++ b/src/pywiiuse/pygame_wiimote.py @@ -22,6 +22,7 @@ import time # events to use. Is there a way to get ones known to be unused? base = pygame.USEREVENT +print 'pygame_wiimote base :', pygame.USEREVENT WIIMOTE_BUTTON_PRESS = base + 1 WIIMOTE_BUTTON_RELEASE = base + 2 WIIMOTE_ACCEL = base + 3 @@ -32,6 +33,10 @@ NUNCHUK_ACCEL = base + 7 NUNCHUK_JOY = base + 8 WIIMOTE_STATUS = base + 9 WIIMOTE_DISCONNECT = base + 10 +pygame.USEREVENT = WIIMOTE_DISCONNECT +if pygame.USEREVENT > pygame.NUMEVENTS : + pygame.NUMEVENTS = pygame.USEREVENT + wiiuse = None # import within the thread, why do I have to do this? -- 2.20.1