Microsoft DirectX 8.1 (Visual Basic) |
Describes the state of a joystick device with extended capabilities. This type is used with the DirectInputDevice8.GetDeviceStateJoystick2 method.
Most applications do not need to use this type, which is for highly specialized controllers including force-feedback devices. For standard game controllers, use the DIJOYSTATE type and obtain data by calling DirectInputDevice8.GetDeviceStateJoystick.
Type DIJOYSTATE2 arx As Long ary As Long arz As Long aslider (0 to 1) As Long ax As Long ay As Long az As Long Buttons(0 To 127) As Byte frx As Long fry As Long frz As Long fslider(0 To 1) As Long fx As Long fy As Long fz As Long POV(0 To 3) As Long rx As Long ry As Long rz As Long slider(0 To 1) As Long vrx As Long vry As Long vrz As Long vslider(0 To 1) As Long vx As Long vy As Long vz As Long x As Long y As Long z As Long End Type
You must prepare the device for access to a joystick with extended capabilities by calling the DirectInputDevice8.SetCommonDataFormat method, passing the DIFORMAT_JOYSTICK2 data format variable.
If an axis is in relative mode, then the appropriate member contains the change in position. If it is in absolute mode, then the member contains the absolute axis position.
Some drivers report the centered position of the POV indicator as 65,535. You can determine whether an indicator is centered as follows:
Dim POVCentered as Boolean POVCentered = MyDijoystate2.POV(0) And &HFFFF
Note Under Microsoft® DirectX® 7, sliders on some joysticks could be assigned to the Z axis, with subsequent code retrieving data from that member. Using DirectX 8, those same sliders will be assigned to the slider array. This should be taken into account when porting applications to DirectX 8. Make any necessary alterations to ensure that slider data is retrieved from the slider array.