From 2135d89d4f79d723151df0c6f2ed0206fa71cd64 Mon Sep 17 00:00:00 2001 From: pin Date: Fri, 9 Apr 2010 13:18:39 +0000 Subject: [PATCH 1/1] =?utf8?q?Impl=C3=A9mentation=20du=20clic=20sur=20le?= =?utf8?q?=20bouton=20B.?= 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@135 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/pywiiuse/pygame_wiimouse.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/pywiiuse/pygame_wiimouse.py b/src/pywiiuse/pygame_wiimouse.py index c57cad8..5e764ce 100755 --- a/src/pywiiuse/pygame_wiimouse.py +++ b/src/pywiiuse/pygame_wiimouse.py @@ -76,7 +76,26 @@ class wiimote_thread(Thread): def event_cb(self, wmp): '''Called when the library has some data for the user.''' wm = wmp[0] - pygame.mouse.set_pos((wm.ir.x, wm.ir.y)) + pos = (wm.ir.x, wm.ir.y) + pygame.mouse.set_pos(pos) + + eventType = None + + if wm.btns and \ + wiiuse.is_just_pressed(wm, wiiuse.button['B']) : + event = pygame.event.Event(pygame.MOUSEBUTTONDOWN, + pos = pos, + button = 1) + pygame.event.post(event) + + if wm.btns_released and \ + wiiuse.is_released(wm, wiiuse.button['B']): + event = pygame.event.Event(pygame.MOUSEBUTTONUP, + pos = pos, + button = 1) + pygame.event.post(event) + + def control_cb(self, wmp, attachment, speaker, ir, led, battery): '''Could check the battery level and such here''' -- 2.20.1