Microsoft DirectX 8.1 (Visual Basic)

DIJOYSTATE

Describes the state of a joystick device. (This term includes other controllers such as game pads and steering wheels). This type is used with the DirectInputDevice8.GetDeviceStateJoystick method.

Type DIJOYSTATE
    Buttons(0 To 31) As Byte
    POV(0 To 3) As Long
    rx As Long
    ry As Long
    rz As Long
    slider(0 To 1) As Long
    x As Long
    y As Long
    z As Long
End Type

Members

Buttons
Array of buttons. 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.
POV
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
X-axis rotation. If the joystick does not have this, the value is 0.
ry
Y-axis rotation. If the joystick does not have this axis, the value is 0.
rz
Z-axis rotation. If the joystick does not have this axis, the value is 0.
slider
Two additional axes whose semantics depend on the joystick. Use the DirectInputDevice8.GetObjectInfo method to obtain semantic information about these values.
x
X-axis, usually the left-right movement of a stick.
y
Y-axis, usually the forward-backward movement of a stick.
z
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 joystick-style access by calling the DirectInputDevice8.SetCommonDataFormat method, passing the DIFORMAT_JOYSTICK format constant.

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 = MyDijoystate.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.

See Also

DIJOYSTATE2