|Microsoft DirectX 9.0|
To retrieve the current state of the joystick, call the IDirectInputDevice8::GetDeviceState method with a pointer to a DIJOYSTATE or a DIJOYSTATE2 structure, depending on whether the data format was set with c_dfDIJoystick or c_dfDIJoystick2. (See Device Data Formats.) The joystick state returned in the structure includes the coordinates of the axes, the state of the buttons, and the state of the point-of-view controllers.
The first seven members of the DIJOYSTATE structure hold the axis coordinates. The last of these seven, rglSlider, is an array of two values. (See Interpreting Joystick Axis Data.)
The rgdwPOV member contains the position of up to four point-of-view controllers in hundredths of a degree clockwise from north (or forward). The center (neutral) position is reported as ?. For controllers that have only five positions, the position is one of the following values:
Some drivers report a value of 65,535, instead of ?, for the center position. You should check for a centered POV indicator as follows:
BOOL POVCentered = (LOWORD(dwPOV) == 0xFFFF);
The rgbButtons member is an array of bytes, one for each of 32 or 128 buttons, depending on the data format. For each button, the high bit is set if the button is down and it is clear if the button is up or not present.
The DIJOYSTATE2 structure has additional members for information about the velocity, acceleration, force, and torque of the axes.