> ## 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::GetControllerAxisCount

> 取得裝置上一般控制器軸的數目。

取得裝置上一般控制器軸的數目。

## 語法

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

### 參數

此方法沒有參數。

### 傳回值

類型：uint32\_t

裝置上的控制器軸數目；如果裝置沒有控制器軸，則為 0。

## 備註

控制器軸是裝置上未經對應的原始軸。當 [GetSupportedInput](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md) 傳回的值包含 `GameInputKindControllerAxis` 時，裝置即具有控制器軸。來自該裝置且包含 `GameInputKindControllerAxis` 的讀數，會透過 [IGameInputReading::GetControllerAxisCount](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxiscount.md) 回報相同數目的軸。

使用傳回的值來決定您傳遞給 [GetControllerAxisLabels](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrolleraxislabels.md) 或 [IGameInputReading::GetControllerAxisState](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxisstate.md) 之陣列的大小。在裝置連線期間，軸數目不會變更。

在 GameInput v3 及更早版本中，此資訊可從 [GameInputControllerInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/structs/gameinputcontrollerinfo.md) 結構的 `controllerAxisCount` 成員取得，該結構由 [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md) 所傳回 [GameInputDeviceInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 結構的 `controllerInfo` 成員參考。

## 需求

**標頭：** GameInput.h

**程式庫：** gameinput.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[GameInput 概觀](https://docs.xbox.com/zh-TW/build/core-features/common/input/overviews/input-overview.md)\
[GetControllerAxisLabels](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrolleraxislabels.md)\
[IGameInputReading::GetControllerAxisCount](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxiscount.md)\
[IGameInputReading::GetControllerAxisState](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxisstate.md)\
[IGameInputDevice](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## 版本歷程記錄

| 版本 | 變更 |
| - | - |
| **v4** | 已推出。 |


## Related topics

- [GameInputControllerInfo (已淘汰)](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/structs/gameinputcontrollerinfo.md)
- [IGameInputDevice::GetControllerAxisLabels](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrolleraxislabels.md)
- [GetControllerAxisCount](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxiscount.md)
- [IGameInputDevice::GetControllerButtonCount](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerbuttoncount.md)
- [IGameInputDevice::GetControllerSwitchCount](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerswitchcount.md)
