DIJOYSTATE2

The DIJOYSTATE2 structure contains information about the state of a joystick device with extended capabilities. This structure is used with the IDirectInputDevice::GetDeviceState method.

typedef struct DIJOYSTATE2 {

LONG lX;

LONG lY;

LONG lZ;

LONG lRx;

LONG lRy;

LONG lRz;

LONG rglSlider[2];

DWORD rgdwPOV[4];

BYTE rgbButtons[128];

LONG lVX;

LONG lVY;

LONG lVZ;

LONG lVRx;

LONG lVRy;

LONG lVRz;

LONG rglVSlider[2];

LONG lAX;

LONG lAY;

LONG lAZ;

LONG lARx;

LONG lARy;

LONG lARz;

LONG rglASlider[2];

LONG lFX;

LONG lFY;

LONG lFZ;

LONG lFRx;

LONG lFRy;

LONG lFRz;

LONG rglFSlider[2];

} DIJOYSTATE2, *LPDIJOYSTATE2;

lX

Information about the joystick x-axis (usually the left-right movement of a stick).

lY

Information about the joystick y-axis (usually the forward-backward movement of a stick).

lZ

Information about the joystick z-axis (often the throttle control). If the joystick does not have this axis, the value is zero.

lRx

Information about the joystick x-axis rotation. If the joystick does not have this, the value is zero.

lRy

Information about the joystick y-axis rotation. If the joystick does not have this axis, the value is zero.

lRz

Information about the joystick z-axis rotation (often called the rudder). If the joystick does not have this axis, the value is zero.

rglSlider[2]

Two additional axis values (formerly called the u-axis and v-axis) whose semantics depend on the joystick. Use the IDirectInputDevice::GetObjectInfo method to obtain semantic information about these values.

rgdwPOV[4]

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, dwPOV will be -1, 0, 9,000, 18,000, or 27,000.

rgbButtons[128]

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.

lVX

Information about the x-axis velocity.

lVY

Information about the y-axis velocity.

lVZ

Information about the z-axis velocity.

lVRx

Information about the x-axis angular velocity.

lVRy

Information about the y-axis angular velocity.

lVRz

Information about the z-axis angular velocity.

rglVSlider[2]

Information about extra axis velocities.

lAX

Information about the x-axis acceleration.

lAY

Information about the y-axis acceleration.

lAZ

Information about the z-axis acceleration.

lARx

Information about the x-axis angular acceleration.

lARy

Information about the y-axis angular acceleration.

lARz

Information about the z-axis angular acceleration.

rglASlider[2]

Information about extra axis accelerations.

lFX

Information about the x-axis force.

lFY

Information about the y-axis force.

lFZ

Information about the z-axis force.

lFRx

Information about the x-axis torque.

lFRy

Information about the y-axis torque.

lFRz

Information about the z-axis torque.

rglFSlider[2]

Information about extra axis forces.

Remarks

You must prepare the device for access to a joystick with extended capabilities by calling the IDirectInputDevice::SetDataFormat method, passing the c_dfDIJoystick2 global data format variable.

The DIJOYSTATE2 structure has no special association with the IDirectInputDevice2 interface. You can use either DIJOYSTATE or DIJOYSTATE2 with either the IDirectInputDevice or the IDirectInputDevice2 interface.

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. Determine whether the indicator is centered as follows:

BOOL POVCentered = (LOWORD(dwPOV) == 0xFFFF);

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Use Windows 95 OSR2 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in dinput.h.