XInputGetState
Retrieves the current state of the specified controller.
Syntax
DWORD XInputGetState(
DWORD dwUserIndex,
XINPUT_STATE * pState
)
Parameters
dwUserIndex _In_
Type: DWORD
Index of the gamer associated with the device; a value in the range of 0 to XUSER_MAX_COUNT - 1
.
pState _Out_
Type: XINPUT_STATE*
Pointer to an XINPUT_STATE object that receives the current state of the controller.
Return value
Type: DWORD
If the function succeeds, it returns ERROR_SUCCESS
.
If the controller is not connected, the function returns ERROR_DEVICE_NOT_CONNECTED
.
If the function fails, it returns an error code defined in WinError.h.
Remarks
This function reports the left and right triggers separately. In DirectInput, the two triggers shared the same axis.
The XInputGetStateWithToken function is similar but allows the caller to supply a D3DX frame pipeline token to associate a specific input reading with a graphics frame for later analysis in PIX.
For more information, see The XInputOnGameInput wrapper.
Requirements
Header: XInputOnGameInput.h
Library: xgameruntime.lib
Supported platforms: Xbox One family consoles and Xbox Series consoles