跳转到主要内容
获取设备上通用控制器开关(例如帽子开关和方向键)的数量。

语法

参数

此方法没有参数。

返回值

类型:uint32_t 设备上控制器开关的数量;如果设备没有控制器开关,则为 0。

备注

控制器开关是设备上未映射的原始多位置开关,例如帽子开关和方向键。当 GetSupportedInput 返回的值包含 GameInputKindControllerSwitch 时,设备具有控制器开关。来自该设备且包含 GameInputKindControllerSwitch 的读数会通过 IGameInputReading::GetControllerSwitchCount 报告相同数量的开关。 使用返回的值来确定传递给 GetControllerSwitchInfo 或 IGameInputReading::GetControllerSwitchState 的数组大小。在设备保持连接期间,开关的数量不会更改。 在 GameInput v3 及更早版本中,此信息可从 GameInputControllerInfo 结构的 controllerSwitchCount 成员中获取,该结构由 IGameInputDevice::GetDeviceInfo 返回的 GameInputDeviceInfo 结构的 controllerInfo 成员引用。

要求

头文件: GameInput.h 库: gameinput.lib 支持的平台: Windows、XBOX One 系列主机和 XBOX Series 主机

另请参阅

GameInput 概述
GetControllerSwitchInfo
IGameInputReading::GetControllerSwitchCount
IGameInputReading::GetControllerSwitchState
IGameInputDevice

版本历史

最后修改于 2026年11月6日