Controller: Support general axis input events

This commit is contained in:
Connor McLaughlin
2019-12-15 00:31:07 +10:00
parent 32d8b4dc84
commit 6e18e56089
6 changed files with 74 additions and 8 deletions

View File

@ -21,6 +21,8 @@ bool Controller::Transfer(const u8 data_in, u8* data_out)
return false;
}
void Controller::SetAxisState(s32 axis_code, float value) {}
void Controller::SetButtonState(s32 button_code, bool pressed) {}
std::unique_ptr<Controller> Controller::Create(ControllerType type)
@ -38,6 +40,24 @@ std::unique_ptr<Controller> Controller::Create(ControllerType type)
}
}
std::optional<s32> Controller::GetAxisCodeByName(std::string_view button_name) const
{
return std::nullopt;
}
std::optional<s32> Controller::GetAxisCodeByName(ControllerType type, std::string_view axis_name)
{
switch (type)
{
case ControllerType::DigitalController:
return DigitalController::StaticGetAxisCodeByName(axis_name);
case ControllerType::None:
default:
return std::nullopt;
}
}
std::optional<s32> Controller::GetButtonCodeByName(ControllerType type, std::string_view button_name)
{
switch (type)