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

# XInputOnGameInput

> XInputOnGameInput

# XInputOnGameInput

Microsoft 游戏开发工具包 (GDK) 提供了头文件 XInputOnGameInput.h，其中包含基于 GameInput 的 XInput API 实现。我们建议直接移植到 GameInput，尤其是当你需要键盘和鼠标或其他输入设备时。不过，XInputOnGameInput 包装器可用于协助启动初始移植工作，而无需对现有 XInput 代码进行任何更改。

## 函数

| 函数                                                                                                          | 描述                                   |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| [XInputEnable](/reference/input/xinputongameinput/functions/xinputenable)                                   | XInputEnable API 参考                  |
| [XInputGetAudioDeviceIds](/reference/input/xinputongameinput/functions/xinputgetaudiodeviceids)             | 检索连接到指定控制器的耳机上音频渲染和捕获设备的 ID。         |
| [XInputGetBatteryInformation](/reference/input/xinputongameinput/functions/xinputgetbatteryinformation)     | 检索无线控制器的电池类型和充电状态。                   |
| [XInputGetCapabilities](/reference/input/xinputongameinput/functions/xinputgetcapabilities)                 | 检索已连接控制器的功能和特性。                      |
| [XInputGetDeviceId](/reference/input/xinputongameinput/functions/xinputgetdeviceid)                         | 检索指定控制器的设备 ID。                       |
| [XInputGetKeystroke](/reference/input/xinputongameinput/functions/xinputgetkeystroke)                       | XInputGetKeystroke API 参考            |
| [XInputGetState](/reference/input/xinputongameinput/functions/xinputgetstate)                               | 检索指定控制器的当前状态。                        |
| [XInputGetStateWithToken](/reference/input/xinputongameinput/functions/xinputgetstatewithtoken)             | 检索指定控制器的当前状态，并将其与 D3DX 帧管线令牌相关联。     |
| [XInputOnGameInputInitialize](/reference/input/xinputongameinput/functions/xinputongameinputinitialize)     | XInputOnGameInputInitialize API 参考   |
| [XInputOnGameInputUninitialize](/reference/input/xinputongameinput/functions/xinputongameinputuninitialize) | XInputOnGameInputUninitialize API 参考 |
| [XInputSetState](/reference/input/xinputongameinput/functions/xinputsetstate)                               | 将振动数据发送到指定的双电机控制器。                   |
| [XInputSetStateEx](/reference/input/xinputongameinput/functions/xinputsetstateex)                           | 将振动数据发送到指定的控制器。支持较新控制器的四电机振动功能。      |

## 结构

| 结构                                                                                                    | 描述                               |
| ----------------------------------------------------------------------------------------------------- | -------------------------------- |
| [XINPUT\_BATTERY\_INFORMATION](/reference/input/xinputongameinput/structs/xinput_battery_information) | 描述电池的类型和充电状态。                    |
| [XINPUT\_CAPABILITIES](/reference/input/xinputongameinput/structs/xinput_capabilities)                | XINPUT\_CAPABILITIES API 参考      |
| [XINPUT\_GAMEPAD](/reference/input/xinputongameinput/structs/xinput_gamepad)                          | XINPUT\_GAMEPAD API 参考           |
| [XINPUT\_KEYSTROKE](/reference/input/xinputongameinput/structs/xinput_keystroke)                      | 描述 XInputGetKeystroke 函数返回的击键数据。 |
| [XINPUT\_STATE](/reference/input/xinputongameinput/structs/xinput_state)                              | 描述控制器的状态。                        |
| [XINPUT\_VIBRATION](/reference/input/xinputongameinput/structs/xinput_vibration)                      | 描述双电机控制器振动功能的电机速度。               |
| [XINPUT\_VIBRATION\_EX](/reference/input/xinputongameinput/structs/xinput_vibration_ex)               | 描述四电机控制器振动功能的电机速度。               |

## 概念文档

* [从 XInput 移植到 GameInput](/build/core-features/common/input/porting/input-porting-xinput)

## 另请参阅

[输入 API 参考](/reference/input/gc-reference-input-toc)
