> ## 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](/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxiscount) 获取该数量。

*stateArray*   \_Out\_writes\_(stateArrayCount)
类型:float\*

指向存放轴状态数据的数组的指针。

### 返回值

类型:uint32\_t

返回有效缓冲区条目的数量。

## 注解

游戏控制器上的大多数模拟控件（摇杆、扳机、滑块、拨盘等）都作为轴呈现，其值为线性归一化到 \[0.0, 1.0] 范围的浮点数。大多数数字输入作为按钮呈现，其值为简单的布尔值。方向开关（Hat switch）作为开关值呈现，其位置由 [GameInputSwitchPosition](/reference/input/gameinput/enums/gameinputswitchposition) 枚举值之一表示。

## 要求

**头文件:** GameInput.h

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

## 版本历史

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


## Related topics

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