diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2019-10-25 19:33:59 -0500 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2020-09-25 20:29:18 -0500 |
| commit | f015c99a5193400a9798616c0a265e5c66916c55 (patch) | |
| tree | 208cbf282429b08bcec09fca9562af87acc931fb /Source/Core/InputCommon/ControllerInterface/Device.cpp | |
| parent | d2729df281485651cbc3c27e4c9419f43fe61408 (diff) | |
ControllerInterface: Add platform consistent names for modifier keys.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/Device.cpp')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Device.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp index cd056af0d8..e57e1c7682 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp @@ -103,6 +103,39 @@ bool Device::FullAnalogSurface::IsMatchingName(std::string_view name) const return old_name == name; } +Device::CombinedInput::CombinedInput(std::string name, const Inputs& inputs) + : m_name(std::move(name)), m_inputs(inputs) +{ +} + +ControlState Device::CombinedInput::GetState() const +{ + ControlState result = 0; + + if (m_inputs.first) + result = m_inputs.first->GetState(); + + if (m_inputs.second) + result = std::max(result, m_inputs.second->GetState()); + + return result; +} + +std::string Device::CombinedInput::GetName() const +{ + return m_name; +} + +bool Device::CombinedInput::IsDetectable() +{ + return false; +} + +void Device::AddCombinedInput(std::string name, const std::pair<std::string, std::string>& inputs) +{ + AddInput(new CombinedInput(std::move(name), {FindInput(inputs.first), FindInput(inputs.second)})); +} + // // DeviceQualifier :: ToString // |
