DIJOYSTATE
The DIJOYSTATE structure contains information about the state of a joystick device. This structure is used with the IDirectInputDevice7::GetDeviceState method.
typedef struct DIJOYSTATE {
LONG lX;
LONG lY;
LONG lZ;
LONG lRx;
LONG lRy;
LONG lRz;
LONG rglSlider[2];
DWORD rgdwPOV[4];
BYTE rgbButtons[32];
} DIJOYSTATE, *LPDIJOYSTATE;
Members
- 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 0.
- lRx
- Information about the joystick x-axis rotation. If the joystick does not have this, the value is 0.
- lRy
- Information about the joystick y-axis rotation. If the joystick does not have this axis, the value is 0.
- lRz
- Information about the joystick z-axis rotation (often called the rudder). If the joystick does not have this axis, the value is 0.
- rglSlider[2]
- Two additional axis values (formerly called the u-axis and v-axis) whose semantics depend on the joystick. Use the IDirectInputDevice7::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 indicators). The position is indicated in hundredths of a degree 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 is –1, 0, 9,000, 18,000, or 27,000.
- rgbButtons[32]
- 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.
Remarks
You must prepare the device for joystick-style access by calling the IDirectInputDevice7::SetDataFormat method, passing the c_dfDIJoystick global data format variable.
If an axis is in relative mode, the appropriate member contains the change in position. If it is in absolute mode, 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);
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in dinput.h.