Access the Axis
BlitzMax Forums/BlitzMax Programming/Access the Axis
| ||
The freejoy module only lets us access these: Const JOY_X=0<br> Const JOY_Y=1<br> Const JOY_Z=2<br> Const JOY_R=3<br> Const JOY_U=4<br> Const JOY_V=5<br> Const JOY_YAW=6<br> Const JOY_PITCH=7<br> Const JOY_ROLL=8<br> Const JOY_HAT=9<br> Const JOY_WHEEL=10<br> Can we just call Function JoyAnyAxis#( port=0, ax ) SampleJoy port Return joy_axis[port*16 + ax] End Function for ax = 11,12,13,14 and 15 ? Reason is: there are some controls not yet accounted for (JoySlider() ?) Anyone have an axis they can test that on? joytest.bmx ?MacOS Framework BRL.GLMax2D ?Win32 Framework BRL.D3D7Max2D ? Import PUB.FreeJoy Import BRL.Retro ?Win32 SetGraphicsDriver D3D7Max2DDriver() ? 'If Not JoyCount() RuntimeError "No joystick found!" Graphics 640,480 Function drawprop(n$,p#,y) Local w DrawText n$,0,y w=Abs(p)*256 If p<0 DrawRect 320-w,y,w,16 Else DrawRect 320,y,w,16 EndIf End Function Local t=0 While Not KeyHit(KEY_ESCAPE) Cls SetColor 255,255,255 Local n=JoyCount() DrawText "joycount="+n,0,0 DrawText "JoyName(0)="+JoyName(0),0,20 DrawText "JoyButtonCaps(0)="+Bin$(JoyButtonCaps(0)),0,40 DrawText "JoyAxisCaps(0)="+Bin$(JoyAxisCaps(0)),0,60 For Local i=0 To 31 SetColor 255,255,255 If JoyDown(i) SetColor 255,0,0 DrawOval i*16,80,14,14 Next SetColor 255,255,0 drawprop "JoyX=",JoyX(0),100 drawprop "JoyY:",JoyY(0),120 drawprop "JoyZ:",JoyZ(0),140 drawprop "JoyR:",JoyR(0),160 drawprop "JoyU:",JoyU(0),180 drawprop "JoyV:",JoyV(0),200 drawprop "JoyHat:",JoyHat(0),220 drawprop "JoyWheel:",JoyWheel(0),240 drawprop "JoyAxis 11:",JoyWhat(0,11),260 drawprop "JoyAxis 12:",JoyWhat(0,12),280 drawprop "JoyAxis 13:",JoyWhat(0,13),300 drawprop "JoyAxis 14:",JoyWhat(0,14),320 drawprop "JoyAxis 15:",JoyWhat(0,15),340 drawprop "JoyAxis 16:",JoyWhat(0,16),360 DrawRect 0,380,t,10 t=(t+1)&511 Flip Wend End Function JoyWhat#( port=0, axis ) SampleJoy port Return joy_axis[port*16+axis] End Function |
| ||
Might I suggest you add this little code to the buttons draw loop, Mark? I can never tell which button I press :)For Local i=0 To 31 SetColor 255,255,255 If JoyDown(i) SetColor 255,0,0 DrawOval i*16,80,14,14 SetColor 0,0,0 DrawText i, i*16,80 Next I would also love to be able to access the rumble function... |
| ||
I don't know the answer to Mark's question, but I think you'll need to write a DirectInput joystick to get rumblepad compatibility. I'm not sure if this would mean a complete re-write of the joystick module, or perhaps you could mix and match DirectInput with the API currently used. |
| ||
OS X has the force-feedback framework; you can find out more information below: http://developer.apple.com/documentation/DeviceDrivers/Reference/ForceFeedback/index.html |
| ||
If you want rumble support i have a dll to let you use xbox gamepads, its a bit sloppy but it works. |
| ||
Any chance I can get a copy of that too Smiler? Just got an xbox control pad, so would be very handy. |
| ||
Double post. |