Microsoft DirectX 8.1 (C++) |
DIJOYSTATE2
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;
Members
- lX
- X-axis, usually the left-right movement of a stick.
- lY
- Y-axis, usually the forward-backward movement of a stick.
- lZ
- Z-axis, often the throttle control. If the joystick does not have this axis, the value is 0.
- lRx
- X-axis rotation. If the joystick does not have this axis, the value is 0.
- lRy
- Y-axis rotation. If the joystick does not have this axis, the value is 0.
- lRz
- 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 IDirectInputDevice8::GetObjectInfo method to obtain semantic information about these values.
- rgdwPOV[4]
- Direction controllers, such as point-of-view hats. 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[128]
- 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.
- lVX
- X-axis velocity.
- lVY
- Y-axis velocity.
- lVZ
- Z-axis velocity.
- lVRx
- X-axis angular velocity.
- lVRy
- Y-axis angular velocity.
- lVRz
- Z-axis angular velocity.
- rglVSlider[2]
- Extra axis velocities.
- lAX
- X-axis acceleration.
- lAY
- Y-axis acceleration.
- lAZ
- Z-axis acceleration.
- lARx
- X-axis angular acceleration.
- lARy
- Y-axis angular acceleration.
- lARz
- Z-axis angular acceleration.
- rglASlider[2]
- Extra axis accelerations.
- lFX
- X-axis force.
- lFY
- Y-axis force.
- lFZ
- Z-axis force.
- lFRx
- X-axis torque.
- lFRy
- Y-axis torque.
- lFRz
- Z-axis torque.
- rglFSlider[2]
- Extra axis forces.
Remarks
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 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 rglSlider 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 rglSlider array.
Requirements
Windows NT/2000/XP: Requires Windows 2000.
Windows 98/Me: Requires Windows 98 or later. Available as a redistributable for Windows 98.
Header: Declared in Dinput.h.