SharpDX.XInput
A XInput controller.
Initializes a new instance of the class.
Index of the user.
Gets the battery information.
Type of the battery device.
unsigned int XInputGetBatteryInformation([In] XUSER_INDEX dwUserIndex,[In] BATTERY_DEVTYPE devType,[Out] XINPUT_BATTERY_INFORMATION* pBatteryInformation)
Gets the capabilities.
Type of the device query.
unsigned int XInputGetCapabilities([In] XUSER_INDEX dwUserIndex,[In] XINPUT_DEVQUERYTYPE dwFlags,[Out] XINPUT_CAPABILITIES* pCapabilities)
Gets the keystroke.
The flag.
The keystroke.
unsigned int XInputGetKeystroke([In] XUSER_INDEX dwUserIndex,[In] unsigned int dwReserved,[Out] XINPUT_KEYSTROKE* pKeystroke)
Gets the state.
Sets the reporting.
if set to true [enable reporting].
Sets the vibration.
The vibration.
Gets a value indicating whether this instance is connected.
true if this instance is connected; otherwise, false.
Gets the sound render GUID.
Gets the sound capture GUID.
typedef struct _XINPUT_GAMEPAD { WORD wButtons; BYTE bLeftTrigger; BYTE bRightTrigger; SHORT sThumbLX; SHORT sThumbLY; SHORT sThumbRX; SHORT sThumbRY;
} , *PXINPUT_GAMEPAD;
Members
- wButtons Bitmask of the device digital buttons, as follows. A set bit indicates that the corresponding button is pressed.
#define 0x00000001
#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.
- bLeftTrigger The current value of the left trigger analog control. The value is between 0 and 255.
- bRightTrigger The current value of the right trigger analog control. The value is between 0 and 255.
- sThumbLX Left thumbstick x-axis value. Each of the thumbstick axis members is a signed value between -32768 and 32767 describing the position of the thumbstick. A value of 0 is centered. Negative values signify down or to the left. Positive values signify up or to the right. The constants or can be used as a positive and negative value to filter a thumbstick input.
- sThumbLY Left thumbstick y-axis value. The value is between -32768 and 32767.
- sThumbRX Right thumbstick x-axis value. The value is between -32768 and 32767.
- sThumbRY Right thumbstick y-axis value. The value is between -32768 and 32767.
XINPUT_GAMEPAD
Constant TriggerThreshold.
XINPUT_GAMEPAD_TRIGGER_THRESHOLD
Constant LeftThumbDeadZone.
XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE
Constant RightThumbDeadZone.
XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE
Bitmask of the device digital buttons, as follows. A set bit indicates that the corresponding button is pressed.
#define 0x00000001
#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.
XINPUT_GAMEPAD_BUTTON_FLAGS wButtons
The current value of the left trigger analog control. The value is between 0 and 255.
unsigned char bLeftTrigger
The current value of the right trigger analog control. The value is between 0 and 255.
unsigned char bRightTrigger
Left thumbstick x-axis value. Each of the thumbstick axis members is a signed value between -32768 and 32767 describing the position of the thumbstick. A value of 0 is centered. Negative values signify down or to the left. Positive values signify up or to the right. The constants or can be used as a positive and negative value to filter a thumbstick input.
short sThumbLX
Left thumbstick y-axis value. The value is between -32768 and 32767.
short sThumbLY
Right thumbstick x-axis value. The value is between -32768 and 32767.
short sThumbRX
Right thumbstick y-axis value. The value is between -32768 and 32767.
short sThumbRY
No documentation.
BATTERY_DEVTYPE
No documentation.
BATTERY_DEVTYPE_GAMEPAD
No documentation.
BATTERY_DEVTYPE_HEADSET
The OID_WW_GEN_BATTERY_LEVEL OID requests the miniport driver to return the current charge of the battery as follows:
BATTERY_LEVEL
No documentation.
BATTERY_LEVEL_EMPTY
No documentation.
BATTERY_LEVEL_LOW
No documentation.
BATTERY_LEVEL_MEDIUM
No documentation.
BATTERY_LEVEL_FULL
No documentation.
BATTERY_TYPE
No documentation.
BATTERY_TYPE_DISCONNECTED
No documentation.
BATTERY_TYPE_WIRED
No documentation.
BATTERY_TYPE_ALKALINE
No documentation.
BATTERY_TYPE_NIMH
No documentation.
BATTERY_TYPE_UNKNOWN
No documentation.
XINPUT_CAPS_FLAGS
No documentation.
XINPUT_CAPS_FFB_SUPPORTED
No documentation.
XINPUT_CAPS_WIRELESS
No documentation.
XINPUT_CAPS_VOICE_SUPPORTED
No documentation.
XINPUT_CAPS_PMD_SUPPORTED
No documentation.
XINPUT_CAPS_NO_NAVIGATION
None.
None
No documentation.
XINPUT_DEVQUERYTYPE
No documentation.
XINPUT_FLAG_GAMEPAD
No documentation.
XINPUT_FLAG_ANY
No documentation.
XINPUT_DEVSUBTYPE
No documentation.
XINPUT_DEVSUBTYPE_GAMEPAD
No documentation.
XINPUT_DEVSUBTYPE_UNKNOWN
No documentation.
XINPUT_DEVSUBTYPE_WHEEL
No documentation.
XINPUT_DEVSUBTYPE_ARCADE_STICK
No documentation.
XINPUT_DEVSUBTYPE_FLIGHT_STICK
No documentation.
XINPUT_DEVSUBTYPE_DANCE_PAD
No documentation.
XINPUT_DEVSUBTYPE_GUITAR
No documentation.
XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE
No documentation.
XINPUT_DEVSUBTYPE_DRUM_KIT
No documentation.
XINPUT_DEVSUBTYPE_GUITAR_BASS
No documentation.
XINPUT_DEVSUBTYPE_ARCADE_PAD
No documentation.
XINPUT_DEVTYPE
No documentation.
XINPUT_DEVTYPE_GAMEPAD
No documentation.
XINPUT_GAMEPAD_BUTTON_FLAGS
No documentation.
XINPUT_GAMEPAD_DPAD_UP
No documentation.
XINPUT_GAMEPAD_DPAD_DOWN
No documentation.
XINPUT_GAMEPAD_DPAD_LEFT
No documentation.
XINPUT_GAMEPAD_DPAD_RIGHT
No documentation.
XINPUT_GAMEPAD_START
No documentation.
XINPUT_GAMEPAD_BACK
No documentation.
XINPUT_GAMEPAD_LEFT_THUMB
No documentation.
XINPUT_GAMEPAD_RIGHT_THUMB
No documentation.
XINPUT_GAMEPAD_LEFT_SHOULDER
No documentation.
XINPUT_GAMEPAD_RIGHT_SHOULDER
No documentation.
XINPUT_GAMEPAD_A
No documentation.
XINPUT_GAMEPAD_B
No documentation.
XINPUT_GAMEPAD_X
No documentation.
XINPUT_GAMEPAD_Y
None.
None
No documentation.
XINPUT_GAMEPAD_KEY_CODE
No documentation.
VK_PAD_A
No documentation.
VK_PAD_B
No documentation.
VK_PAD_X
No documentation.
VK_PAD_Y
No documentation.
VK_PAD_RSHOULDER
No documentation.
VK_PAD_LSHOULDER
No documentation.
VK_PAD_LTRIGGER
No documentation.
VK_PAD_RTRIGGER
No documentation.
VK_PAD_DPAD_UP
No documentation.
VK_PAD_DPAD_DOWN
No documentation.
VK_PAD_DPAD_LEFT
No documentation.
VK_PAD_DPAD_RIGHT
No documentation.
VK_PAD_START
No documentation.
VK_PAD_BACK
No documentation.
VK_PAD_LTHUMB_PRESS
No documentation.
VK_PAD_RTHUMB_PRESS
No documentation.
VK_PAD_LTHUMB_UP
No documentation.
VK_PAD_LTHUMB_DOWN
No documentation.
VK_PAD_LTHUMB_RIGHT
No documentation.
VK_PAD_LTHUMB_LEFT
No documentation.
VK_PAD_LTHUMB_UPLEFT
No documentation.
VK_PAD_LTHUMB_UPRIGHT
No documentation.
VK_PAD_LTHUMB_DOWNRIGHT
No documentation.
VK_PAD_LTHUMB_DOWNLEFT
No documentation.
VK_PAD_RTHUMB_UP
No documentation.
VK_PAD_RTHUMB_DOWN
No documentation.
VK_PAD_RTHUMB_RIGHT
No documentation.
VK_PAD_RTHUMB_LEFT
No documentation.
VK_PAD_RTHUMB_UPLEFT
No documentation.
VK_PAD_RTHUMB_UPRIGHT
No documentation.
VK_PAD_RTHUMB_DOWNRIGHT
No documentation.
VK_PAD_RTHUMB_DOWNLEFT
None.
None
No documentation.
XINPUT_KEYSTROKE_FLAGS
No documentation.
XINPUT_KEYSTROKE_KEYDOWN
No documentation.
XINPUT_KEYSTROKE_KEYUP
No documentation.
XINPUT_KEYSTROKE_REPEAT
None.
None
No documentation.
XUSER_INDEX
No documentation.
XUSER_INDEX_ANY
No documentation.
XUSER_INDEX_ONE
No documentation.
XUSER_INDEX_TWO
No documentation.
XUSER_INDEX_THREE
No documentation.
XUSER_INDEX_FOUR
Functions
DWORD ( DWORD
Parameters
- dwUserIndex[in] Index of the signed-in gamer associated with the device. Can be a value in the range 0?XUSER_MAX_COUNT???1, or to fetch the next available input event from any user.
- dwReserved[in] Input flags that identify the device type. ValueDescriptionXINPUT_FLAG_GAMEPADLimit input event fetch to the gamepad.?
- pKeystroke[out] Pointer to an structure that receives an input event.
Return Value 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 . (See Remarks.)
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.
[in] Index of the signed-in gamer associated with the device. Can be a value in the range 0?XUSER_MAX_COUNT???1, or to fetch the next available input event from any user.
[in] Input flags that identify the device type. ValueDescriptionXINPUT_FLAG_GAMEPADLimit input event fetch to the gamepad.?
[out] Pointer to an structure that receives an input event.
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 . (See Remarks.) 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.
unsigned int XInputGetKeystroke([In] unsigned int dwUserIndex,[In] unsigned int dwReserved,[Out] XINPUT_KEYSTROKE* pKeystroke)
DWORD ( DWORD
Parameters
- dwUserIndex[in] Index of the user's controller. Can be a value from 0 to 3. For information about how this value is determined and how the value maps to indicators on the controller, see Multiple Controllers.
- pVibration[in, out] Pointer to an structure containing the vibration information to send to the controller.
Return Value 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.
[in] Index of the user's controller. Can be a value from 0 to 3. For information about how this value is determined and how the value maps to indicators on the controller, see Multiple Controllers.
[in, out] Pointer to an structure containing the vibration information to send to the controller.
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.
unsigned int XInputSetState([In] unsigned int dwUserIndex,[In] XINPUT_VIBRATION* pVibration)
DWORD ( DWORD
Parameters
- dwUserIndex[in] Index of the user's controller. It can be a value in the range 0?3. For information about how this value is determined and how the value maps to indicators on the controller, see Multiple Controllers.
- pDSoundRenderGuid[out, optional] Pointer that receives the of the headset sound rendering device.
- pDSoundCaptureGuid[out, optional] Pointer that receives the of the headset sound capture device.
Return Value If the function successfully retrieves the device IDs for render and capture, the return code is .
If there is no headset connected to the controller, the function also retrieves with GUID_NULL as the values for pDSoundRenderGuid and pDSoundCaptureGuid.
If the controller port device is not physically connected, the function returns .
If the function fails, it returns a valid Win32 error code.
[in] Index of the user's controller. It can be a value in the range 0?3. For information about how this value is determined and how the value maps to indicators on the controller, see Multiple Controllers.
[out, optional] Pointer that receives the of the headset sound rendering device.
[out, optional] Pointer that receives the of the headset sound capture device.
If the function successfully retrieves the device IDs for render and capture, the return code is . If there is no headset connected to the controller, the function also retrieves with GUID_NULL as the values for pDSoundRenderGuid and pDSoundCaptureGuid. If the controller port device is not physically connected, the function returns . If the function fails, it returns a valid Win32 error code.
unsigned int XInputGetDSoundAudioDeviceGuids([In] unsigned int dwUserIndex,[Out, Optional] GUID* pDSoundRenderGuid,[Out, Optional] GUID* pDSoundCaptureGuid)
DWORD ( DWORD
Parameters
- dwUserIndex[in] Index of the user's controller. Can be a value from 0 to 3. For information about how this value is determined and how the value maps to indicators on the controller, see Multiple Controllers.
- pState[out] Pointer to an structure that receives the current state of the controller.
Return Value 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.
[in] Index of the user's controller. Can be a value from 0 to 3. For information about how this value is determined and how the value maps to indicators on the controller, see Multiple Controllers.
[out] Pointer to an structure that receives the current state of the controller.
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.
unsigned int XInputGetState([In] unsigned int dwUserIndex,[Out] XINPUT_STATE* pState)
void (
Parameters
- enable If enable is , XInput will only send neutral data in response to (all buttons up, axes centered, and triggers at 0). calls will be registered but not sent to the device. Sending any value other than will restore reading and writing functionality to normal.
Return ValueNone.
If enable is , XInput will only send neutral data in response to (all buttons up, axes centered, and triggers at 0). calls will be registered but not sent to the device. Sending any value other than will restore reading and writing functionality to normal.
void XInputEnable([In] BOOL enable)
DWORD ( DWORD
Parameters
- dwUserIndex[in] Index of the user's controller. Can be a value in the range 0?3. For information about how this value is determined and how the value maps to indicators on the controller, see Multiple Controllers.
- dwFlags[in] Input flags that identify the controller type. If this value is 0, then the capabilities of all controllers connected to the system are returned. Currently, only one value is supported: ValueDescriptionXINPUT_FLAG_GAMEPADLimit 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.
- pCapabilities[out] Pointer to an structure that receives the controller capabilities.
Return Value 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.
[in] Index of the user's controller. Can be a value in the range 0?3. For information about how this value is determined and how the value maps to indicators on the controller, see Multiple Controllers.
[in] Input flags that identify the controller type. If this value is 0, then the capabilities of all controllers connected to the system are returned. Currently, only one value is supported: ValueDescriptionXINPUT_FLAG_GAMEPADLimit 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.
[out] Pointer to an structure that receives the controller capabilities.
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.
unsigned int XInputGetCapabilities([In] unsigned int dwUserIndex,[In] XINPUT_DEVQUERYTYPE dwFlags,[Out] XINPUT_CAPABILITIES* pCapabilities)
No documentation.
No documentation.
No documentation.
No documentation.
No documentation.
No documentation.
No documentation.
unsigned int XInputGetAudioEndpointIds([In] unsigned int dwUserIndex,[Out, Buffer, Optional] wchar_t* pRenderEndpointId,[InOut, Optional] unsigned int* pRenderCount,[Out, Buffer, Optional] wchar_t* pCaptureEndpointId,[InOut, Optional] unsigned int* pCaptureCount)
DWORD ( DWORD
Parameters
- dwUserIndex[in] Index of the signed-in gamer associated with the device. Can be a value in the range 0?XUSER_MAX_COUNT???1.
- devType[in] Specifies which device associated with this user index should be queried. Must be or .
- pBatteryInformation[out] Pointer to an structure that receives the battery information.
Return Value If the function succeeds, the return value is .
[in] Index of the signed-in gamer associated with the device. Can be a value in the range 0?XUSER_MAX_COUNT???1.
[in] Specifies which device associated with this user index should be queried. Must be or .
[out] Pointer to an structure that receives the battery information.
If the function succeeds, the return value is .
unsigned int XInputGetBatteryInformation([In] unsigned int dwUserIndex,[In] BATTERY_DEVTYPE devType,[Out] XINPUT_BATTERY_INFORMATION* pBatteryInformation)
typedef struct _XINPUT_BATTERY_INFORMATION { BYTE BatteryType; BYTE BatteryLevel;
} , *PXINPUT_BATTERY_INFORMATION;
Members
- BatteryType The type of battery. BatteryType will be one of the following values. ValueDescriptionBATTERY_TYPE_DISCONNECTEDThe device is not connected.?BATTERY_TYPE_WIREDThe device is a wired device and does not have a battery.?BATTERY_TYPE_ALKALINEThe device has an alkaline battery.?BATTERY_TYPE_NIMHThe device has a nickel metal hydride battery.?BATTERY_TYPE_UNKNOWNThe device has an unknown battery type.?
- BatteryLevel The charge state of the battery. This value is only valid for wireless devices with a known battery type. BatteryLevel will be one of the following values. ValueBATTERY_LEVEL_EMPTYBATTERY_LEVEL_LOWBATTERY_LEVEL_MEDIUMBATTERY_LEVEL_FULL
XINPUT_BATTERY_INFORMATION
The type of battery. BatteryType will be one of the following values. ValueDescriptionBATTERY_TYPE_DISCONNECTEDThe device is not connected.?BATTERY_TYPE_WIREDThe device is a wired device and does not have a battery.?BATTERY_TYPE_ALKALINEThe device has an alkaline battery.?BATTERY_TYPE_NIMHThe device has a nickel metal hydride battery.?BATTERY_TYPE_UNKNOWNThe device has an unknown battery type.?
BATTERY_TYPE BatteryType
The charge state of the battery. This value is only valid for wireless devices with a known battery type. BatteryLevel will be one of the following values. ValueBATTERY_LEVEL_EMPTYBATTERY_LEVEL_LOWBATTERY_LEVEL_MEDIUMBATTERY_LEVEL_FULL
BATTERY_LEVEL BatteryLevel
XInputGetCapabilities
XINPUT_CAPABILITIES
No documentation.
XINPUT_DEVTYPE Type
No documentation.
XINPUT_DEVSUBTYPE SubType
No documentation.
XINPUT_CAPS_FLAGS Flags
No documentation.
XINPUT_GAMEPAD Gamepad
No documentation.
XINPUT_VIBRATION Vibration
XInputGetKeystroke
XINPUT_KEYSTROKE
No documentation.
XINPUT_GAMEPAD_KEY_CODE VirtualKey
No documentation.
wchar_t Unicode
No documentation.
XINPUT_KEYSTROKE_FLAGS Flags
No documentation.
XUSER_INDEX UserIndex
No documentation.
unsigned char HidCode
typedef struct _XINPUT_STATE { DWORD dwPacketNumber; Gamepad;
} , *PXINPUT_STATE;
Members
- dwPacketNumber State packet number. The packet number indicates whether there have been any changes in the state of the controller. If the dwPacketNumber member is the same in sequentially returned structures, the controller state has not changed.
- Gamepad structure containing the current state of an Xbox 360 Controller.
XINPUT_STATE
State packet number. The packet number indicates whether there have been any changes in the state of the controller. If the dwPacketNumber member is the same in sequentially returned structures, the controller state has not changed.
unsigned int dwPacketNumber
structure containing the current state of an Xbox 360 Controller.
XINPUT_GAMEPAD Gamepad
typedef struct _XINPUT_VIBRATION { WORD wLeftMotorSpeed; WORD wRightMotorSpeed;
} , *PXINPUT_VIBRATION;
Members
- wLeftMotorSpeed Speed of the left motor. Valid values are in the range 0 to 65,535. Zero signifies no motor use; 65,535 signifies 100 percent motor use.
- wRightMotorSpeed Speed of the right motor. Valid values are in the range 0 to 65,535. Zero signifies no motor use; 65,535 signifies 100 percent motor use.
XINPUT_VIBRATION
Speed of the left motor. Valid values are in the range 0 to 65,535. Zero signifies no motor use; 65,535 signifies 100 percent motor use.
unsigned short wLeftMotorSpeed
Speed of the right motor. Valid values are in the range 0 to 65,535. Zero signifies no motor use; 65,535 signifies 100 percent motor use.
unsigned short wRightMotorSpeed
Common error code from XInput
Device is not connected