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

# 将 GameInput 与现有输入堆栈结合

> 将 GameInput 与现有输入堆栈结合

<a id="introductionSection" />

由于 GameInput 的功能能够可扩展地支持未来设备并对应用程序进行抽象，我们仍建议应用程序尽可能将输入代码迁移到 `GameInput`。`GameInput` 的功能是先前所有输入 API 的超集。因此，从先前的输入 API 移植在大多数情况下都是简单直接的过程。最大的变化通常来自 `GameInput` 是“以输入为中心”而非“以设备为中心”。使用先前 API 的代码通常先枚举输入设备再读取其输入。而在 `GameInput` 中，这不是必需的。将代码调整为 `GameInput` 的“以输入为中心”模型，通常构成先前代码所需的大部分结构性变化。

以下主题介绍了 `GameInput` 与先前输入 API 之间的差异细节，并包含突出这些 API 之间最大差异的代码示例。

[从 Windows.Xbox.Input 移植到 GameInput](/build/core-features/common/input/porting/input-porting-wxi)

介绍从原始 XBOX One 软件开发工具包中的 `Windows.Xbox.Input` 移植。

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

介绍从 `XInput` 移植。

<a id="sideBySideSection" />

## 将 GameInput 与旧版 API 并行使用

对于希望将 GameInput 代码与旧接口和 API 并行使用的应用程序，该 API 具有足够灵活性以支持此用例。这样应用程序可以轻松利用传感器和触觉反馈支持等新能力，而无需替换整个输入堆栈。自版本 1 (v1) 起，`GameInputDeviceInfo` 包含 `pnppath` 字段，表示底层设备的路径。此字段与 DirectInput 提供的 `DIPROPGUIDANDPATH` 中的路径相同，也可供应用程序通过调用 `CreateFile` 直接与设备交互。请注意，非游戏手柄的 Game Input Protocol (GIP) 设备可能没有此属性，因为它们无法直接打开。

<a id="seeAlsoSection" />

## 另请参阅

[GameInput 简介](/build/core-features/common/input/overviews/input-overview)

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

[Microsoft Game Development Kit](/services/playfab/sdks/platforms/gdk)
