This structure is used by the
The specific mapping of button to game function varies depending on the game type.
The constant XINPUT_GAMEPAD_TRIGGER_THRESHOLD may be used as the value which bLeftTrigger and bRightTrigger must be greater than to register as pressed. This is optional, but often desirable. Xbox 360 Controller buttons do not manifest crosstalk.
#define0x00000001 #define 0x00000002 #define 0x00000004 #define 0x00000008 #define 0x00000010 #define 0x00000020 #define 0x00000040 #define 0x00000080 #define 0x0100 #define 0x0200 #define 0x1000 #define 0x2000 #define 0x4000 #define 0x8000
Bits that are set but not defined above are reserved, and their state is undefined.
Value | Description |
---|---|
Limit input event fetch to the gamepad.? |
If the function succeeds, the return value is
If no new keys have been pressed, the return value is
If the controller is not connected or the user has not activated it, the return value is
If the function fails, the return value is an error code defined in Winerror.h. The function does not use SetLastError to set the calling thread's last-error code.
Wireless controllers are not considered active upon system startup, and calls to any of the XInput functions before a wireless controller is made active return
If the function succeeds, the return value is
If the controller is not connected, the return value is
If the function fails, the return value is an error code defined in Winerror.h. The function does not use SetLastError to set the calling thread's last-error code.
If the function succeeds, the return value is
If the controller is not connected, the return value is
If the function fails, the return value is an error code defined in Winerror.h. The function does not use SetLastError to set the calling thread's last-error code.
When
Value | Description |
---|---|
Limit query to devices of Xbox 360 Controller type.? |
Any value of dwflags other than the above or 0 is illegal and will result in an error break when debugging.
If the function succeeds, the return value is
If the controller is not connected, the return value is
If the function fails, the return value is an error code defined in Winerror.h. The function does not use SetLastError to set the calling thread's last-error code.
This function is meant to be called when an application gains or loses focus (such as via WM_ACTIVATEAPP). Using this function, you will not have to change the XInput query loop in your application as neutral data will always be reported if XInput is disabled.
In a controller that supports vibration effects:
Passing
Passing TRUE will pass the last vibration request (even if it is 0) sent to
If the function succeeds, the return value is
Value | Description |
---|---|
The device is not connected.? | |
The device is a wired device and does not have a battery.? | |
The device has an alkaline battery.? | |
The device has a nickel metal hydride battery.? | |
The device has an unknown battery type.? |
Value |
---|
The SubType member indicates the specific subtype of controller present. Games may detect the controller subtype and tune their handling of controller input or output based on subtypes that are well suited to their game genre. For example, a car racing game might check for the presence of a wheel controller to provide finer control of the car being driven. However, titles must not disable or ignore a device based on its subtype. Subtypes not recognized by the game or for which the game is not specifically tuned should be treated as a standard Xbox 360 Controller (
Older XUSB Windows drivers report incomplete capabilities information, particularly for wireless devices. The latest XUSB Windows driver provides full support for wired and wireless devices, and more complete and accurate capabilties flags.
Future devices may return HID codes and virtual key values that are not supported on current devices, and are currently undefined. Applications should ignore these unexpected values.
A virtual-key code is a byte value that represents a particular physical key on the keyboard, not the character or characters (possibly none) that the key can be mapped to based on keyboard state. The keyboard state at the time a virtual key is pressed modifies the character reported. For example, VK_4 might represent a "4" or a "$", depending on the state of the SHIFT key.
A reported keyboard event includes the virtual key that caused the event, whether the key was pressed or released (or is repeating), and the state of the keyboard at the time of the event. The keyboard state includes information about whether any CTRL, ALT, or SHIFT keys are down.
If the keyboard event represents an Unicode character (for example, pressing the "A" key), the Unicode member will contain that character. Otherwise, Unicode will contain the value zero.
The valid virtual-key (VK_xxx) codes are defined in XInput.h. In addition to codes that indicate key presses, the following codes indicate controller input.
Value | Description |
---|---|
A button? | |
B button? | |
X button? | |
Y button? | |
Right shoulder button? | |
Left shoulder button? | |
Left trigger? | |
Right trigger? | |
Directional pad up? | |
Directional pad down? | |
Directional pad left? | |
Directional pad right? | |
START button? | |
BACK button? | |
Left thumbstick click? | |
Right thumbstick click? | |
Left thumbstick up? | |
Left thumbstick down? | |
Left thumbstick right? | |
Left thumbstick left? | |
Left thumbstick up and left? | |
Left thumbstick up and right? | |
Left thumbstick down and right? | |
Left thumbstick down and left? | |
Right thumbstick up? | |
Right thumbstick down? | |
Right thumbstick right? | |
Right thumbstick left? | |
Right thumbstick up and left? | |
Right thumbstick up and right? | |
Right thumbstick down and right? | |
Right thumbstick down and left? |
The dwPacketNumber member is incremented only if the status of the controller has changed since the controller was last polled.
The left motor is the low-frequency rumble motor. The right motor is the high-frequency rumble motor. The two motors are not the same, and they create different vibration effects.