projects
/
minwii.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ajout Amsterdam.
[minwii.git]
/
src
/
pywiiuse
/
pygame_wiimouse.py
diff --git
a/src/pywiiuse/pygame_wiimouse.py
b/src/pywiiuse/pygame_wiimouse.py
index
8a4f6e0
..
f77856c
100755
(executable)
--- a/
src/pywiiuse/pygame_wiimouse.py
+++ b/
src/pywiiuse/pygame_wiimouse.py
@@
-60,7
+60,6
@@
class wiimote_thread(Thread):
func, args = self.queue.get_nowait()
except Empty:
break
func, args = self.queue.get_nowait()
except Empty:
break
- print 'do:', func.__name__, args
func(*args)
def pause(self) :
func(*args)
def pause(self) :
@@
-122,25
+121,37
@@
class wiimote_thread(Thread):
wiiuse.disconnect(self.wiimotes[i])
self.go = False
wiiuse.disconnect(self.wiimotes[i])
self.go = False
+ def get_count(self):
+ return self.actual_nmotes
+
+
WT = None
WT = None
-def init(nmotes, timeout, screenResolution=(660, 370)):
+def init(nmotes, timeout, screenResolution=(660, 370)
, position='ABOVE'
):
'''Initialize the module.'''
global WT
if WT:
return
WT = wiimote_thread(nmotes, timeout)
'''Initialize the module.'''
global WT
if WT:
return
WT = wiimote_thread(nmotes, timeout)
+ if position == 'ABOVE' :
+ position = wiiuse.IR_ABOVE
+ elif position == 'BELOW' :
+ position = wiiuse.IR_BELOW
+ else :
+ position = wiiuse.IR_ABOVE
+
+
nmotes = get_count()
for i in range(nmotes) :
wm = Wiimote(i) # access the wiimote object
wm.enable_accels(0) # turn off acceleration reporting
nmotes = get_count()
for i in range(nmotes) :
wm = Wiimote(i) # access the wiimote object
wm.enable_accels(0) # turn off acceleration reporting
- wm.enable_ir(1, vres = screenResolution, position=
wiiuse.IR_BELOW
)
+ wm.enable_ir(1, vres = screenResolution, position=
position
)
def get_count():
'''How many Wiimotes were found?'''
def get_count():
'''How many Wiimotes were found?'''
- return WT.
actual_nmotes
+ return WT.
get_count()
def quit():
'''Gracefully shutdown the connection and turn off the wiimote leds'''
def quit():
'''Gracefully shutdown the connection and turn off the wiimote leds'''
@@
-192,7
+203,6
@@
class wiimote(object):
enable |= wiiuse.ORIENT_THRESH
else:
disable |= wiiuse.ORIENT_THRESH
enable |= wiiuse.ORIENT_THRESH
else:
disable |= wiiuse.ORIENT_THRESH
- print enable, disable
WT.do(wiiuse.set_flags, self.wm, enable, disable)
def set_orient_thresh(self, thresh):
WT.do(wiiuse.set_flags, self.wm, enable, disable)
def set_orient_thresh(self, thresh):