ControllerEmu: Expose gate size setting for octagon analog sticks.
This commit is contained in:
parent
e18053d307
commit
643f82539c
|
@ -65,9 +65,18 @@ OctagonAnalogStick::OctagonAnalogStick(const char* name_, ControlState gate_radi
|
||||||
|
|
||||||
OctagonAnalogStick::OctagonAnalogStick(const char* name_, const char* ui_name_,
|
OctagonAnalogStick::OctagonAnalogStick(const char* name_, const char* ui_name_,
|
||||||
ControlState gate_radius)
|
ControlState gate_radius)
|
||||||
: AnalogStick(name_, ui_name_, std::make_unique<ControllerEmu::OctagonStickGate>(gate_radius))
|
: AnalogStick(name_, ui_name_, std::make_unique<ControllerEmu::OctagonStickGate>(1.0))
|
||||||
{
|
{
|
||||||
AddVirtualNotchSetting(&m_virtual_notch_setting, 45);
|
AddVirtualNotchSetting(&m_virtual_notch_setting, 45);
|
||||||
|
|
||||||
|
AddSetting(
|
||||||
|
&m_gate_size_setting,
|
||||||
|
{_trans("Gate Size"),
|
||||||
|
// i18n: The percent symbol.
|
||||||
|
_trans("%"),
|
||||||
|
// i18n: Refers to plastic shell of game controller (stick gate) that limits stick movements.
|
||||||
|
_trans("Adjusts target radius of simulated stick gate.")},
|
||||||
|
gate_radius * 100, 0.01, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlState OctagonAnalogStick::GetVirtualNotchSize() const
|
ControlState OctagonAnalogStick::GetVirtualNotchSize() const
|
||||||
|
@ -75,4 +84,9 @@ ControlState OctagonAnalogStick::GetVirtualNotchSize() const
|
||||||
return m_virtual_notch_setting.GetValue() * MathUtil::TAU / 360;
|
return m_virtual_notch_setting.GetValue() * MathUtil::TAU / 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ControlState OctagonAnalogStick::GetGateRadiusAtAngle(double ang) const
|
||||||
|
{
|
||||||
|
return AnalogStick::GetGateRadiusAtAngle(ang) * m_gate_size_setting.GetValue() / 100;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ControllerEmu
|
} // namespace ControllerEmu
|
||||||
|
|
|
@ -36,9 +36,11 @@ public:
|
||||||
OctagonAnalogStick(const char* name, const char* ui_name, ControlState gate_radius);
|
OctagonAnalogStick(const char* name, const char* ui_name, ControlState gate_radius);
|
||||||
|
|
||||||
ControlState GetVirtualNotchSize() const override;
|
ControlState GetVirtualNotchSize() const override;
|
||||||
|
ControlState GetGateRadiusAtAngle(double ang) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SettingValue<double> m_virtual_notch_setting;
|
SettingValue<double> m_virtual_notch_setting;
|
||||||
|
SettingValue<double> m_gate_size_setting;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ControllerEmu
|
} // namespace ControllerEmu
|
||||||
|
|
Loading…
Reference in New Issue