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

> IGameInputReading::GetControllerAxisState

# IGameInputReading::GetControllerAxisState

從遊戲控制器擷取軸狀態資訊。

## 語法

```cpp theme={null}
uint32_t GetControllerAxisState(
    uint32_t stateArrayCount,
    float* stateArray
);
```

### 參數

*stateArrayCount*   \_In\_\
類型：uint32\_t

用來擷取遊戲控制器上各軸的預期狀態陣列數目。
此數目可從 [IGameInputReading::GetControllerAxisCount](/zh-TW/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxiscount) 擷取

*stateArray*   \_Out\_writes\_(stateArrayCount)
類型：float\*

指向包含軸狀態資料之陣列的指標。

### 傳回值

類型：uint32\_t

傳回有效的緩衝區項目數目。

## 備註

遊戲控制器上大部分的類比控制項 (搖桿、扳機、滑桿、轉盤等) 都會以軸的形式呈現，軸是線性正規化至 \[0.0, 1.0] 範圍的浮點數值。大部分的數位輸入會以按鈕的形式呈現，按鈕是簡單的布林值。帽型開關會以開關值的形式呈現，其位置以其中一個 [GameInputSwitchPosition](/zh-TW/reference/input/gameinput/enums/gameinputswitchposition) 列舉值表示。

## 需求

**標頭：** GameInput.h

[輸入 API 概觀](/zh-TW/build/core-features/common/input/overviews/input-overview)\
[IGameInputReading](/zh-TW/reference/input/gameinput/interfaces/igameinputreading/igameinputreading)

## 版本歷程記錄

| 版本 | 變更 |
| - | - |
| **v0** | 推出。 |


## Related topics

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