> ## 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.

# IGameInputDevice::GetControllerSwitchCount

> デバイス上の汎用コントローラー スイッチ (ハット スイッチや方向パッドなど) の数を取得します。

デバイス上の汎用コントローラー スイッチ (ハット スイッチや方向パッドなど) の数を取得します。

## 構文

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

### パラメーター

このメソッドにはパラメーターがありません。

### 戻り値

型: uint32\_t

デバイス上のコントローラー スイッチの数。デバイスにコントローラー スイッチがない場合は 0。

## 解説

コントローラー スイッチは、ハット スイッチや方向パッドなど、デバイスのマッピングされていない生の多方向スイッチです。[GetSupportedInput](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md) から返される値に `GameInputKindControllerSwitch` が含まれている場合、そのデバイスにはコントローラー スイッチがあります。`GameInputKindControllerSwitch` を含むデバイスからの読み取りは、[IGameInputReading::GetControllerSwitchCount](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrollerswitchcount.md) を通じて同じ数のスイッチを報告します。

返された値を使用して、[GetControllerSwitchInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerswitchinfo.md) または [IGameInputReading::GetControllerSwitchState](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrollerswitchstate.md) に渡す配列のサイズを決定します。デバイスが接続されている間、スイッチの数は変化しません。

GameInput v3 以前では、この情報は [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md) から返される [GameInputDeviceInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 構造体の `controllerInfo` メンバーが参照する [GameInputControllerInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/structs/gameinputcontrollerinfo.md) 構造体の `controllerSwitchCount` メンバーから取得できました。

## 要件

**ヘッダー:** GameInput.h

**ライブラリ:** gameinput.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体、XBOX Series 本体

## 関連項目

[GameInput の概要](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-overview.md)\
[GetControllerSwitchInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerswitchinfo.md)\
[IGameInputReading::GetControllerSwitchCount](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrollerswitchcount.md)\
[IGameInputReading::GetControllerSwitchState](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrollerswitchstate.md)\
[IGameInputDevice](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## バージョン履歴

| バージョン | 変更内容 |
| - | - |
| **v4** | 導入されました。 |


## Related topics

- [IGameInputDevice::GetControllerSwitchInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerswitchinfo.md)
- [GetControllerSwitchCount](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrollerswitchcount.md)
- [IGameInputDevice::GetControllerButtonCount](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerbuttoncount.md)
- [IGameInputDevice::GetControllerAxisCount](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrolleraxiscount.md)
- [IGameInputDevice::GetControllerButtonLabels](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerbuttonlabels.md)
