Skip to main content
Gets the number of generic controller switches, such as hat switches and directional pads, on the device.

Syntax

Parameters

This method has no parameters.

Return value

Type: uint32_t The number of controller switches on the device, or 0 if the device has no controller switches.

Remarks

Controller switches are the raw, unmapped multi-position switches of a device, such as hat switches and directional pads. A device has controller switches when the value returned by GetSupportedInput includes GameInputKindControllerSwitch. Readings from the device that include GameInputKindControllerSwitch report the same number of switches through IGameInputReading::GetControllerSwitchCount. Use the returned value to size the array that you pass to GetControllerSwitchInfo or to IGameInputReading::GetControllerSwitchState. The number of switches doesn’t change while the device is connected. In GameInput v3 and earlier, this information was available from the controllerSwitchCount member of the GameInputControllerInfo structure, which was referenced by the controllerInfo member of the GameInputDeviceInfo structure returned by IGameInputDevice::GetDeviceInfo.

Requirements

Header: GameInput.h Library: gameinput.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

See also

Overview of GameInput
GetControllerSwitchInfo
IGameInputReading::GetControllerSwitchCount
IGameInputReading::GetControllerSwitchState
IGameInputDevice

Version History

Last modified on November 5, 2026