common/input: Add helpers functions for creating input and output devices

Avoids the redundancy of needing to explictly specify the common
namespace and the type.
This commit is contained in:
Lioncash
2022-11-28 09:19:01 -05:00
parent 7f42432f42
commit 2ec7d0b5fd
7 changed files with 102 additions and 90 deletions

View File

@ -68,7 +68,7 @@ void EmulatedConsole::ReloadInput() {
// If you load any device here add the equivalent to the UnloadInput() function
SetTouchParams();
motion_devices = Common::Input::CreateDevice<Common::Input::InputDevice>(motion_params);
motion_devices = Common::Input::CreateInputDevice(motion_params);
if (motion_devices) {
motion_devices->SetCallback({
.on_change =
@ -79,7 +79,7 @@ void EmulatedConsole::ReloadInput() {
// Unique index for identifying touch device source
std::size_t index = 0;
for (auto& touch_device : touch_devices) {
touch_device = Common::Input::CreateDevice<Common::Input::InputDevice>(touch_params[index]);
touch_device = Common::Input::CreateInputDevice(touch_params[index]);
if (!touch_device) {
continue;
}