> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IGameInputReading::GetControllerSwitchCount

> IGameInputReading::GetControllerSwitchCount

# IGameInputReading::GetControllerSwitchCount

检索游戏控制器上的开关（switch）数量。

## 语法

```cpp theme={null}
uint32_t GetControllerSwitchCount();
```

### 参数

此方法没有参数。

### 返回值

类型：uint32\_t

返回游戏控制器上的开关数量。

## 备注

`IGameInputReading::GetControllerSwitchCount` 方法用于检索游戏控制器的开关数量。它同时也决定了 [IGameInputReading::GetControllerSwitchState](/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrollerswitchstate) 方法所需的缓冲区大小。有关 GameInput API 的中级和高级用例，请参见 [GameInput 高级主题](/build/core-features/common/input/advanced/input-advanced-topics)。

## 要求

**头文件：** GameInput.h

[GameInput 概述](/build/core-features/common/input/overviews/input-overview)\
[IGameInputReading](/reference/input/gameinput/interfaces/igameinputreading/igameinputreading)

## 版本历史

| 版本     | 更改  |
| ------ | --- |
| **v0** | 引入。 |


## Related topics

- [IGameInputReading::GetControllerSwitchState](/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrollerswitchstate.md)
- [IGameInputReading::GetControllerAxisCount](/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxiscount.md)
- [IGameInputReading::GetControllerButtonCount](/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrollerbuttoncount.md)
- [IGameInputReading::GetControllerAxisState](/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxisstate.md)
- [IGameInputReading::GetControllerButtonState](/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrollerbuttonstate.md)
