입력 장치의 전체 속성 및 기능에 대한 정적 정보에 액세스합니다.
구문
HRESULT GetDeviceInfo(
const GameInputDeviceInfo** info
);
매개 변수
info _Outptr_
형식: GameInputDeviceInfo**
IGameInputDevice와 연결된 디바이스 정보입니다.
반환 값
형식: HRESULT
함수 결과입니다.
설명
응용 프로그램은 GetDeviceInfo 메서드를 소유하지 않습니다. 응용 프로그램이 IGameInput 인스턴스를 활성 상태로 유지하는 경우 메모리에 계속 액세스할 수 있습니다.
IGameInput 개체에 대한 참조가 해제되면 메모리가 사라집니다.
다음 코드 예제 데모는 게임 패드에서 추가 버튼을 식별하는 방법을 보여줍니다.
bool IsGamepadButton(IGameInputDevice* gamepad, uint32_t buttonIndex) noexcept
{
const GameInputDeviceInfo* gamepadInfo = nullptr;
const bool succeeded = gamepad->GetDeviceInfo(&gamepadInfo);
assert(succeeded);
assert(buttonIndex < gamepadInfo->controllerButtonCount);
const auto buttonInfo = &gamepadInfo->controllerButtonInfo[buttonIndex];
const bool isGamepadButton = (buttonInfo->mappedInput & GameInputKindGamepad);
return isGamepadButton;
}
다음 코드 예제는 레이싱 휠에 클러치가 있는지 여부를 확인하는 방법을 보여줍니다.
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
라이브러리: gameinput.lib
지원되는 플랫폼: Windows