Re: [Pyobjc-dev] More wiimote wrapping fun!
Brought to you by:
ronaldoussoren
|
From: John H. <joh...@gm...> - 2008-02-20 06:33:18
|
For those that are interested in getting the data from rawIRData in
the wiimote framework, I've developed a hack that works, but is
ugly. I've rolled my own framework by added a method to the delegate
in WiiRemote.h:
- (void) rawIRDataHackX1:(int) x1 Y1:(int) y1 S1:(int)s1 X2:(int) x2
Y2:(int) y2 S2:(int)s2 X3:(int) x3 Y3:(int) y3 S3:(int)s3 X4:(int) x4
Y4:(int) y4 S4:(int)s4;
I also added this to the end of the handleIRData method in WiiRemote.m:
if ([_delegate respondsToSelector:@selector
(rawIRDataHackX1:Y1:S1:X2:Y2:S2:X3:Y3:S3:X4:Y4:S4:)])
[_delegate rawIRDataHackX1:irData[0].x Y1:irData[0].y S1:irData
[0].s X2:irData[1].x Y2:irData[1].y S2:irData[1].s X3:irData[2].x
Y3:irData[2].y S3:irData[2].s X4:irData[3].x Y4:irData[3].y S4:irData
[3].s];
and then in my python code:
WiiRemoteDelegate = objc.informal_protocol(
"WiiRemoteDelegate",
[
objc.selector(None,
selector="irPointMovedX:Y:",
signature="v@:ff", isRequired=False),
objc.selector(None,
selector="rawIRData:",
signature="v@:[4{?=iii}]", isRequired=False),
objc.selector(None,
selector="rawIRDataHackX1:Y1:S1:X2:Y2:S2:X3:Y3:S3:X4:Y4:S4:",
signature="v@:iiiiiiiiiiii", isRequired=False),
and
def rawIRDataHackX1_Y1_S1_X2_Y2_S2_X3_Y3_S3_X4_Y4_S4_(self,
*posargs, **kwdargs):
for x in posargs:
print '%8x' % (x)
This works and I get data for the IR points. If anyone can tell me
how to properly wrap the normal rawIRData method I'd appreciate it,
but at least I can continue development with this solution.
|