[HID] Fix Demo for XInput

This commit is contained in:
Joel Linn 2019-10-18 17:51:49 +02:00 committed by Rick Gibbed
parent 0d866aa173
commit 2aa008e02e
1 changed files with 10 additions and 4 deletions

View File

@ -42,18 +42,24 @@ std::vector<std::unique_ptr<hid::InputDriver>> CreateInputDrivers(
drivers.emplace_back(xe::hid::nop::Create(window)); drivers.emplace_back(xe::hid::nop::Create(window));
#if XE_PLATFORM_WIN32 #if XE_PLATFORM_WIN32
} else if (cvars::hid.compare("winkey") == 0) { } else if (cvars::hid.compare("winkey") == 0) {
drivers.emplace_back(xe::hid::winkey::Create(window)); auto driver = xe::hid::winkey::Create(window);
if (XSUCCEEDED(driver->Setup())) {
drivers.emplace_back(std::move(driver));
}
} else if (cvars::hid.compare("xinput") == 0) { } else if (cvars::hid.compare("xinput") == 0) {
drivers.emplace_back(xe::hid::xinput::Create(window)); auto driver = xe::hid::xinput::Create(window);
if (XSUCCEEDED(driver->Setup())) {
drivers.emplace_back(std::move(driver));
}
#endif // XE_PLATFORM_WIN32 #endif // XE_PLATFORM_WIN32
} else { } else {
#if XE_PLATFORM_WIN32 #if XE_PLATFORM_WIN32
auto xinput_driver = xe::hid::xinput::Create(window); auto xinput_driver = xe::hid::xinput::Create(window);
if (xinput_driver) { if (xinput_driver && XSUCCEEDED(xinput_driver->Setup())) {
drivers.emplace_back(std::move(xinput_driver)); drivers.emplace_back(std::move(xinput_driver));
} }
auto winkey_driver = xe::hid::winkey::Create(window); auto winkey_driver = xe::hid::winkey::Create(window);
if (winkey_driver) { if (winkey_driver && XSUCCEEDED(winkey_driver->Setup())) {
drivers.emplace_back(std::move(winkey_driver)); drivers.emplace_back(std::move(winkey_driver));
} }
#endif // XE_PLATFORM_WIN32 #endif // XE_PLATFORM_WIN32