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

> 检索设备的飞行摇杆属性，例如其按钮、帽子开关和轴的标签。

检索设备的飞行摇杆属性，例如其按钮、帽子开关和轴的标签。

## 语法

```cpp theme={null}
bool GetFlightStickInfo(
    GameInputFlightStickInfo* info
);
```

### 参数

*info*   \_Out\_\
类型：[GameInputFlightStickInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputflightstickinfo.md)\*

指向用于接收设备飞行摇杆属性的 `GameInputFlightStickInfo` 结构的指针。如果设备不支持飞行摇杆输入，则该结构的每个成员都设置为零。

### 返回值

类型：bool

如果设备支持飞行摇杆输入并且已填充 *info*，则为 `true`；否则为 `false`。

## 备注

`GetFlightStickInfo` 方法将设备的飞行摇杆属性复制到调用方提供的结构中。当 [GetSupportedInput](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md) 返回的值包含 `GameInputKindFlightStick` 时，设备支持飞行摇杆输入。如果设备不支持飞行摇杆输入，`GetFlightStickInfo` 会将 *info* 零初始化并返回 `false`。

标签成员以 [GameInputLabel](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputlabel.md) 值的形式描述印在相应控件上的标记，以便你在 UI 中显示匹配的提示。`extraButtonCount` 和 `extraAxisCount` 成员报告设备在标准飞行摇杆映射之外还有多少个控制器按钮和轴；使用 [GetExtraButtonIndexes](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getextrabuttonindexes.md) 和 [GetExtraAxisIndexes](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getextraaxisindexes.md) 可在读数的控制器状态中找到它们。飞行摇杆状态通过 [IGameInputReading::GetFlightStickState](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getflightstickstate.md) 从读数中读取。

此方法返回的属性在设备的生存期内是固定的，因此你可以只查询一次（例如在设备连接时）并缓存结果。

以下示例演示如何查询设备的飞行摇杆属性。

```cpp theme={null}
GameInputFlightStickInfo info;
if (device->GetFlightStickInfo(&info))
{
    GameInputLabel firePrimary = info.firePrimaryButtonLabel;
    // ...
}
```

在 GameInput v3 及更早版本中，此信息可从 [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md) 返回的 [GameInputDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 结构的 `flightStickInfo` 成员中获取。

## 要求

**头文件：** GameInput.h

**库：** gameinput.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

[GameInput 概述](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-overview.md)\
[GameInputFlightStickInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputflightstickinfo.md)\
[GetSupportedInput](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md)\
[GameInputKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputkind.md)\
[GameInputLabel](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputlabel.md)\
[IGameInputReading::GetFlightStickState](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getflightstickstate.md)\
[IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## 版本历史

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


## Related topics

- [GameInputFlightStickInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputflightstickinfo.md)
- [IGameInputDevice::GetArcadeStickInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getarcadestickinfo.md)
- [IGameInputDevice::GetInputReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportinfo.md)
- [IGameInputDevice::GetKeyboardInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getkeyboardinfo.md)
- [IGameInputDevice::GetGamepadInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getgamepadinfo.md)
