IXtfInputClient::ConnectGamepad Method
创建虚拟控制器,并获取其设备标识符。语法
参数
pControllerId类型:UINT64 * 指向 UINT64 的指针,用于接收此 IXtfInputClient 的设备标识符。
返回值
类型:HRESULT HRESULT 成功或错误代码。备注
ConnectGamepad 为创建的每个虚拟控制器分配系统资源,并返回将用于通过 IXtfInputClient::SendGamepadReport 向开发主机发送输入的虚拟控制器的标识符。你的代码在调用 ConnectGamepad 后应等待 2 秒再调用 SendGamepadReport,以确保主机已完成新控制器的注册并准备好接受输入。你的代码应始终将对 ConnectGamepad 的调用与对 DisconnectGamepad 的调用配对,以确保这些系统资源被释放以供重用。你也可以调用 IXtfInputClient::DisconnectAllGamepads 一次性释放所有虚拟控制器资源。要求
头文件: xtfinput.h 库: xtfinput.lib 支持的平台: Windows(用于 XBOX 主机工具)另请参阅
XtfInputIXtfInputClient
IXtfInputClient::ConnectGamepad
IXtfInputClient::DisconnectGamepad
IXtfInputClient::DisconnectAllGamepads
