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

# GetControllerSwitchCount

> IGameInputReading::GetControllerSwitchCount

# IGameInputReading::GetControllerSwitchCount

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

## 语法

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

### 参数

此方法没有参数。

### 返回值

类型：uint32\_t

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

## 备注

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

## 要求

**头文件：** GameInput.h

[GameInput 概述](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputReading](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/igameinputreading.md)

## 版本历史

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


## Related topics

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