Joystick axis access

BlitzMax Forums/BlitzMax Programming/Joystick axis access

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This might be usefull for some of you ...
'Constants already defined in freejoy.bmx 
'Const JOY_X=0
'Const JOY_Y=1
'Const JOY_Z=2
'Const JOY_R=3
'Const JOY_U=4
'Const JOY_V=5
'Const JOY_YAW=6
'Const JOY_PITCH=7
'Const JOY_ROLL=8
'Const JOY_HAT=9
'Const JOY_WHEEL=10

'Function to access the axis ... returns -1 to 1 depending on the location of that axis
Function JoyAxis#( axis,port=0 )
  SampleJoy port
  Return joy_axis[port*16+axis]
  End Function


Include that in your code, now you can access all joystick axis in a uniformed manner (like with a for loop) much like the buttons of a joystick!. Make sure you check that the axis is available for use (JoyAxisCaps() command).