Syntax
Parameters
infoArrayCount   _In_Type: uint32_t Number of elements in infoArray. To retrieve all controller switches, pass the value returned by GetControllerSwitchCount. infoArray   _Out_writes_to_opt_(infoArrayCount, return)
Type: GameInputControllerSwitchInfo* Pointer to an array that receives one structure per controller switch. Can be
nullptr, in which case nothing is written and the method returns 0.
Return value
Type: uint32_t The number of elements written to infoArray. This is the smaller of infoArrayCount and the number of controller switches on the device, or 0 if infoArray isnullptr or the device has no controller switches.
Remarks
Each element is a GameInputControllerSwitchInfo structure that describes the kind of the corresponding switch (2-way, 4-way, or 8-way, as a GameInputSwitchKind value) and the label of each of its positions. Call GetControllerSwitchCount to get the number of controller switches, allocate an array of that size, and then callGetControllerSwitchInfo to fill it. If infoArrayCount is smaller than the number of controller switches, only the first infoArrayCount elements are written. The controller switches of a device don’t change while the device is connected, so you can query them once and cache the result.
Element i of the info array describes the switch at index i of the array returned by IGameInputReading::GetControllerSwitchState for readings from this device.
The following example shows how to retrieve the controller switches of a device.
controllerSwitchInfo 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 consolesSee also
Overview of GameInputGetControllerSwitchCount
GameInputControllerSwitchInfo
GameInputSwitchKind
IGameInputReading::GetControllerSwitchState
IGameInputDevice
