summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/ControlGroup
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2020-01-18 13:56:11 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2020-01-18 13:56:11 -0600
commita61dff67daaee2469eeb1f90d5f6089a54ad5e8a (patch)
treefc12105dad85635ee7392670b817524b192f7f26 /Source/Core/InputCommon/ControllerEmu/ControlGroup
parentdd7f9ed5da142f91ba20da38c074033c7342af65 (diff)
InputCommon: List IMUAccelerometer's Up/Down inputs first for consistency.
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/ControlGroup')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp19
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp9
2 files changed, 13 insertions, 15 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp
index 52a9d47a1a..9b680af20f 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp
@@ -17,25 +17,24 @@ namespace ControllerEmu
IMUAccelerometer::IMUAccelerometer(std::string name, std::string ui_name)
: ControlGroup(std::move(name), std::move(ui_name), GroupType::IMUAccelerometer)
{
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Up")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Down")));
controls.emplace_back(std::make_unique<Input>(Translate, _trans("Left")));
controls.emplace_back(std::make_unique<Input>(Translate, _trans("Right")));
controls.emplace_back(std::make_unique<Input>(Translate, _trans("Forward")));
controls.emplace_back(std::make_unique<Input>(Translate, _trans("Backward")));
- controls.emplace_back(std::make_unique<Input>(Translate, _trans("Up")));
- controls.emplace_back(std::make_unique<Input>(Translate, _trans("Down")));
}
std::optional<IMUAccelerometer::StateData> IMUAccelerometer::GetState() const
{
- StateData state;
- state.x = (controls[0]->control_ref->State() - controls[1]->control_ref->State());
- state.y = (controls[3]->control_ref->State() - controls[2]->control_ref->State());
- state.z = (controls[4]->control_ref->State() - controls[5]->control_ref->State());
-
- if (controls[0]->control_ref->BoundCount() != 0)
- return state;
- else
+ if (controls[0]->control_ref->BoundCount() == 0)
return std::nullopt;
+
+ StateData state;
+ state.x = (controls[2]->control_ref->State() - controls[3]->control_ref->State());
+ state.y = (controls[5]->control_ref->State() - controls[4]->control_ref->State());
+ state.z = (controls[0]->control_ref->State() - controls[1]->control_ref->State());
+ return state;
}
} // namespace ControllerEmu
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp
index 3a1ed14b7d..922f7a0d43 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp
@@ -27,15 +27,14 @@ IMUGyroscope::IMUGyroscope(std::string name, std::string ui_name)
std::optional<IMUGyroscope::StateData> IMUGyroscope::GetState() const
{
+ if (controls[0]->control_ref->BoundCount() == 0)
+ return std::nullopt;
+
StateData state;
state.x = (controls[1]->control_ref->State() - controls[0]->control_ref->State());
state.y = (controls[2]->control_ref->State() - controls[3]->control_ref->State());
state.z = (controls[4]->control_ref->State() - controls[5]->control_ref->State());
-
- if (controls[0]->control_ref->BoundCount() != 0)
- return state;
- else
- return std::nullopt;
+ return state;
}
} // namespace ControllerEmu