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