diff options
| author | Filoppi <filippotarpini@hotmail.it> | 2021-05-04 23:47:55 +0300 |
|---|---|---|
| committer | Filoppi <filippotarpini@hotmail.it> | 2021-05-10 23:48:10 +0300 |
| commit | a261e61e9e3941d10cf0ef3adf8eac00f722b6db (patch) | |
| tree | a8bb275ee45fdd65708550088919ca21de1a05a9 /Source/Core/InputCommon/ControllerEmu/ControlGroup | |
| parent | d586163e38acbd93d3568bb209756b56bb712c81 (diff) | |
InputCommon: add a ton of missing consts
fix some related grammar errors
only the ButtonManager required code changes
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/ControlGroup')
13 files changed, 20 insertions, 19 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp index 881be39471..36733c9f7e 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp @@ -32,7 +32,7 @@ AnalogStick::AnalogStick(const char* const name_, const char* const ui_name_, AddInput(Translate, _trans("Modifier")); } -AnalogStick::ReshapeData AnalogStick::GetReshapableState(bool adjusted) +AnalogStick::ReshapeData AnalogStick::GetReshapableState(bool adjusted) const { const ControlState y = controls[0]->GetState() - controls[1]->GetState(); const ControlState x = controls[3]->GetState() - controls[2]->GetState(); @@ -46,7 +46,7 @@ AnalogStick::ReshapeData AnalogStick::GetReshapableState(bool adjusted) return Reshape(x, y, modifier); } -AnalogStick::StateData AnalogStick::GetState() +AnalogStick::StateData AnalogStick::GetState() const { return GetReshapableState(true); } diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h index ac0266f7c1..a5ea05a211 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h @@ -18,10 +18,10 @@ public: AnalogStick(const char* name, std::unique_ptr<StickGate>&& stick_gate); AnalogStick(const char* name, const char* ui_name, std::unique_ptr<StickGate>&& stick_gate); - ReshapeData GetReshapableState(bool adjusted) final override; + ReshapeData GetReshapableState(bool adjusted) const final override; ControlState GetGateRadiusAtAngle(double ang) const override; - StateData GetState(); + StateData GetState() const; private: std::unique_ptr<StickGate> m_stick_gate; diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h index b10677a615..707c93fa81 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h @@ -20,7 +20,7 @@ public: Buttons(const std::string& ini_name, const std::string& group_name); template <typename C> - void GetState(C* const buttons, const C* bitmasks) + void GetState(C* const buttons, const C* bitmasks) const { for (auto& control : controls) *buttons |= *(bitmasks++) * control->GetState<bool>(); diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp index fa379624db..4dbb5a11ed 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp @@ -64,7 +64,7 @@ Cursor::Cursor(std::string name_, std::string ui_name_) AddSetting(&m_autohide_setting, {_trans("Auto-Hide")}, false); } -Cursor::ReshapeData Cursor::GetReshapableState(bool adjusted) +Cursor::ReshapeData Cursor::GetReshapableState(bool adjusted) const { const ControlState y = controls[0]->GetState() - controls[1]->GetState(); const ControlState x = controls[3]->GetState() - controls[2]->GetState(); diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.h index 562313bb45..a6b38fb4bb 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.h @@ -25,9 +25,10 @@ public: Cursor(std::string name, std::string ui_name); - ReshapeData GetReshapableState(bool adjusted) final override; + ReshapeData GetReshapableState(bool adjusted) const final override; ControlState GetGateRadiusAtAngle(double ang) const override; + // Modifies the state StateData GetState(bool adjusted); // Yaw movement in radians. diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp index af9246c54d..457b36205b 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp @@ -65,7 +65,7 @@ Force::Force(const std::string& name_) : ReshapableInput(name_, name_, GroupType 90, 1, 180); } -Force::ReshapeData Force::GetReshapableState(bool adjusted) +Force::ReshapeData Force::GetReshapableState(bool adjusted) const { const ControlState y = controls[0]->GetState() - controls[1]->GetState(); const ControlState x = controls[3]->GetState() - controls[2]->GetState(); @@ -77,7 +77,7 @@ Force::ReshapeData Force::GetReshapableState(bool adjusted) return Reshape(x, y); } -Force::StateData Force::GetState(bool adjusted) +Force::StateData Force::GetState(bool adjusted) const { const auto state = GetReshapableState(adjusted); ControlState z = controls[4]->GetState() - controls[5]->GetState(); diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.h index ae9cabe340..983f668d78 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.h @@ -19,12 +19,12 @@ public: explicit Force(const std::string& name); - ReshapeData GetReshapableState(bool adjusted) final override; + ReshapeData GetReshapableState(bool adjusted) const final override; ControlState GetGateRadiusAtAngle(double ang) const final override; ControlState GetDefaultInputRadiusAtAngle(double angle) const final override; - StateData GetState(bool adjusted = true); + StateData GetState(bool adjusted = true) const; // Velocities returned in m/s. ControlState GetSpeed() const; diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp index bd70c64b53..d8aeea4eee 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp @@ -29,7 +29,7 @@ Slider::Slider(const std::string& name_) : Slider(name_, name_) { } -Slider::StateData Slider::GetState() +Slider::StateData Slider::GetState() const { const ControlState deadzone = m_deadzone_setting.GetValue() / 100; const ControlState state = controls[1]->GetState() - controls[0]->GetState(); diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.h index de969f59b5..930241d7fe 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.h @@ -23,7 +23,7 @@ public: Slider(const std::string& name_, const std::string& ui_name_); explicit Slider(const std::string& name_); - StateData GetState(); + StateData GetState() const; private: SettingValue<double> m_deadzone_setting; diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp index 69739bc330..053d0bf429 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp @@ -42,7 +42,7 @@ Tilt::Tilt(const std::string& name_) : ReshapableInput(name_, name_, GroupType:: 7, 1, 50); } -Tilt::ReshapeData Tilt::GetReshapableState(bool adjusted) +Tilt::ReshapeData Tilt::GetReshapableState(bool adjusted) const { const ControlState y = controls[0]->GetState() - controls[1]->GetState(); const ControlState x = controls[3]->GetState() - controls[2]->GetState(); @@ -56,7 +56,7 @@ Tilt::ReshapeData Tilt::GetReshapableState(bool adjusted) return Reshape(x, y, modifier); } -Tilt::StateData Tilt::GetState() +Tilt::StateData Tilt::GetState() const { return GetReshapableState(true); } diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.h index dc4c2364de..cb50c5eb73 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.h @@ -19,14 +19,14 @@ public: explicit Tilt(const std::string& name); - ReshapeData GetReshapableState(bool adjusted) final override; + ReshapeData GetReshapableState(bool adjusted) const final override; ControlState GetGateRadiusAtAngle(double angle) const final override; // Tilt is using the gate radius to adjust the tilt angle so we must provide an unadjusted value // for the default input radius. ControlState GetDefaultInputRadiusAtAngle(double angle) const final override; - StateData GetState(); + StateData GetState() const; // Return peak rotational velocity (for a complete turn) in radians/sec ControlState GetMaxRotationalVelocity() const; diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Triggers.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Triggers.cpp index bdfec69808..7aaac42b72 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Triggers.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Triggers.cpp @@ -21,7 +21,7 @@ Triggers::Triggers(const std::string& name_) : ControlGroup(name_, GroupType::Tr AddDeadzoneSetting(&m_deadzone_setting, 50); } -Triggers::StateData Triggers::GetState() +Triggers::StateData Triggers::GetState() const { const size_t trigger_count = controls.size(); const ControlState deadzone = m_deadzone_setting.GetValue() / 100; diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Triggers.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Triggers.h index 8b72d6738b..5d75ff09bc 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Triggers.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Triggers.h @@ -26,7 +26,7 @@ public: explicit Triggers(const std::string& name); - StateData GetState(); + StateData GetState() const; private: SettingValue<double> m_deadzone_setting; |
