Controller: Add methods to query buttons/axises for a controller type

This commit is contained in:
Connor McLaughlin
2020-01-02 16:10:42 +10:00
parent 0528a2a1f9
commit 4b1541087a
6 changed files with 86 additions and 0 deletions

View File

@ -62,6 +62,38 @@ std::optional<s32> Controller::GetButtonCodeByName(std::string_view button_name)
return std::nullopt;
}
Controller::AxisList Controller::GetAxisNames(ControllerType type)
{
switch (type)
{
case ControllerType::DigitalController:
return DigitalController::StaticGetAxisNames();
case ControllerType::AnalogController:
return AnalogController::StaticGetAxisNames();
case ControllerType::None:
default:
return {};
}
}
Controller::ButtonList Controller::GetButtonNames(ControllerType type)
{
switch (type)
{
case ControllerType::DigitalController:
return DigitalController::StaticGetButtonNames();
case ControllerType::AnalogController:
return AnalogController::StaticGetButtonNames();
case ControllerType::None:
default:
return {};
}
}
std::optional<s32> Controller::GetAxisCodeByName(ControllerType type, std::string_view axis_name)
{
switch (type)