Describes the state of a joystick device with extended capabilities. This structure is used with the IDirectInputDevice8::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;
You must prepare the device for access to a joystick with extended capabilities by calling the IDirectInputDevice8::SetDataFormat method, passing the c_dfDIJoystick2 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);
Note Under DirectX 7.0, sliders on some joysticks could be assigned to the Z axis, with subsequent code retrieving data from that member. Using DirectX 8.0 and later, those same sliders will be assigned to the rglSlider array. This should be taken into account when porting applications to later versions of DirectX. Make any necessary alterations to ensure that slider data is retrieved from the rglSlider array.