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

# XInputOnGameInputInitialize

> XInputOnGameInputInitialize

# XInputOnGameInputInitialize

初始化 XInput 包装器 API。

## 语法

```cpp theme={null}
HRESULT XInputOnGameInputInitialize(  
)  
```

### 参数

### 返回值

类型：HRESULT

函数的结果。

## 备注

要使用此函数，必须定义 `XINPUT_ON_GAMEINPUT_EXPLICIT_INITIALIZATION` 宏。默认情况下，XInput 在后台初始化，这会导致对 XInput 函数的第一次调用花费明显更长的时间，因为它捆绑了初始化工作。`XINPUT_ON_GAMEINPUT_EXPLICIT_INITIALIZATION` 让你能够更精细地控制 XInput 的初始化和反初始化。要了解更多信息并查看显式初始化的好处，请阅读 [从 XInput 移植到 GameInput](/build/core-features/common/input/porting/input-porting-xinput#optimizingSection)。

## 要求

**头文件：** XInputOnGameInput.h

**库：** xgameruntime.lib

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

## 另请参阅

[将 XInput 移植到 GameInput](/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members)\
[XInputOnGameInputUninitialize](/reference/input/xinputongameinput/functions/xinputongameinputuninitialize)


## Related topics

- [XInputOnGameInputUninitialize](/zh-CN/reference/input/xinputongameinput/functions/xinputongameinputuninitialize.md)
- [XInputOnGameInput](/zh-CN/reference/input/xinputongameinput/xinputongameinput_members.md)
- [从 XInput 移植到 GameInput](/zh-CN/build/core-features/common/input/porting/input-porting-xinput.md)
- [XGameStreamingIsTouchInputEnabled](/zh-CN/reference/system/xgamestreaming/functions/xgamestreamingistouchinputenabled.md)
- [GameInput](/zh-CN/reference/input/gameinput/gameinput_members.md)
