访问与某一输入设备的完整属性和功能有关的信息。
语法
HRESULT GetDeviceInfo(
const GameInputDeviceInfo** info
);
参数
info _Outptr_
类型:GameInputDeviceInfo**
与 IGameInputDevice 关联的设备信息。
返回值
类型:HRESULT
函数结果。
备注
GetDeviceInfo 方法内存还不属于应用程序。 如果应用程序使 IGameInput 实例保持活动状态,则内存将保持可访问状态。 释放对 IGameInput 对象的引用后,内存将会消失。
以下代码示例演示了如何确定某一赛车方向盘是否有离合器。
bool HasClutch(IGameInputDevice* wheel) noexcept
{
const GameInputDeviceInfo* wheelInfo = nullptr;
const bool succeeded = wheel->GetDeviceInfo(&wheelInfo);
assert(succeeded);
assert(wheelInfo->racingWheelInfo);
const bool hasClutch = wheelInfo->racingWheelInfo->hasClutch;
return hasClutch;
}
要求
头文件:GameInput.h