语法
参数
此方法没有参数。返回值
类型:bool 如果设备当前已连接,则为true;否则为 false。
备注
物理设备断开连接后,IGameInputDevice 对象仍然有效,因此你的应用程序可以保留对它的引用。设备断开连接期间,IsConnected 返回 false,并且设备不会生成新的读数。如果设备以相同的设备 ID 重新连接(请参阅 IGameInputDevice::GetDeviceId),GameInput 会重用同一个设备对象,并且 IsConnected 会再次返回 true。
若要在设备连接或断开连接时收到通知,而不是轮询此方法,请通过调用 IGameInput::RegisterDeviceCallback 注册设备回调。该回调会接收 GameInputDeviceEvent 的 GameInputDeviceEventConnected 和 GameInputDeviceEventDisconnected 值。
在 GameInput v3 及更早版本中,需要检查 IGameInputDevice::GetDeviceStatus 返回的值中是否包含 GameInputDeviceConnected 标志。
要求
头文件: GameInput.h 库: gameinput.lib 支持的平台: Windows、XBOX One 系列主机和 XBOX Series 主机另请参阅
GameInput 概述IGameInputDevice
GameInputDeviceEvent
IGameInput::RegisterDeviceCallback
