DirectX SDK

DIJOYSTATE2

The DIJOYSTATE2 type contains information about the state of a joystick device with extended capabilities. This type is used with the DirectInputDevice.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 DirectInputDevice.GetDeviceStateJoystick.

Type DIJOYSTATE2 
    buttons(0 To 31) 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

Members

buttons
Array of button states. The high-order bit of the byte is set if the corresponding button is down and clear if the button is up or does not exist.
frx
Information about the x-axis torque.
fry
Information about the y-axis torque.
frz
Information about the z-axis torque.
fslider
Information about extra axis forces.
fx
Information about the x-axis force.
fy
Information about the y-axis force.
fz
Information about the z-axis force.
POV
The current position of up to four direction controllers (such as point-of-view hats). The position is indicated in hundredths of degrees clockwise from north (away from the user). The center position is normally reported as -1; but see Remarks. For indicators that have only five positions, the value for a controller will be -1, 0, 9,000, 18,000, or 27,000.
rx
Information about the joystick x-axis rotation. If the joystick does not have this, the value is 0.
ry
Information about the joystick y-axis rotation. If the joystick does not have this axis, the value is 0.
rz
Information about the joystick z-axis rotation (often called the rudder). If the joystick does not have this axis, the value is zero.
slider
Two additional axis values whose semantics depend on the joystick. Use the DirectInputDevice.GetObjectInfo method to obtain semantic information about these values.
vrx
Information about the x-axis angular velocity.
vry
Information about the y-axis angular velocity.
vrz
Information about the z-axis angular velocity.
vslider[0 To 1]
Information about extra axis velocities.
vx
Information about the x-axis velocity.
vy
Information about the y-axis velocity.
vz
Information about the z-axis velocity.
x
Information about the joystick x-axis (usually the left-right movement of a stick).
y
Information about the joystick y-axis (usually the forward-backward movement of a stick).
z
Information about the joystick z-axis (often the throttle control). If the joystick does not have this axis, the value is zero.

Remarks

You must prepare the device for access to a joystick with extended capabilities by calling the DirectInputDevice.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;