Merge pull request #8568 from jordan-woyak/imu-accel-ordering

InputCommon: List IMUAccelerometer's Up/Down inputs first for consistency.
This commit is contained in:
JMC47 2020-01-19 16:05:53 -05:00 committed by GitHub
commit f61d77a5e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 15 deletions

View File

@ -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

View File

@ -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;
}
} // namespace ControllerEmu