Merge pull request #8390 from jordan-woyak/wiimote-emu-tilt-fix

WiimoteEmu: Tilt fixes.
This commit is contained in:
Anthony
2019-10-16 16:14:42 -07:00
committed by GitHub
4 changed files with 21 additions and 18 deletions

View File

@ -7,6 +7,7 @@
#include <string>
#include "Common/Common.h"
#include "Common/MathUtil.h"
#include "InputCommon/ControlReference/ControlReference.h"
#include "InputCommon/ControllerEmu/Control/Control.h"
@ -30,7 +31,15 @@ Tilt::Tilt(const std::string& name_) : ReshapableInput(name_, name_, GroupType::
_trans("°"),
// i18n: Refers to emulated wii remote movement.
_trans("Maximum tilt angle.")},
90, 0, 180);
85, 0, 180);
AddSetting(&m_max_rotational_velocity,
{_trans("Velocity"),
// i18n: The symbol/abbreviation for hertz (cycles per second).
_trans("Hz"),
// i18n: Refers to emulated wii remote movement.
_trans("Peak complete turns per second.")},
7, 1, 50);
}
Tilt::ReshapeData Tilt::GetReshapableState(bool adjusted)
@ -63,4 +72,9 @@ ControlState Tilt::GetDefaultInputRadiusAtAngle(double ang) const
return SquareStickGate(1.0).GetRadiusAtAngle(ang);
}
ControlState Tilt::GetMaxRotationalVelocity() const
{
return m_max_rotational_velocity.GetValue() * MathUtil::TAU;
}
} // namespace ControllerEmu

View File

@ -28,7 +28,11 @@ public:
StateData GetState();
// Return peak rotational velocity (for a complete turn) in radians/sec
ControlState GetMaxRotationalVelocity() const;
private:
SettingValue<double> m_max_angle_setting;
SettingValue<double> m_max_rotational_velocity;
};
} // namespace ControllerEmu