InputCommon: Clean up how numeric settings are handled. Add units of measure to UI. Eliminate hidden magic values of the IR cursor.

This commit is contained in:
Jordan Woyak
2019-03-26 19:31:03 -05:00
parent 75e74315e6
commit 5efb717873
55 changed files with 552 additions and 567 deletions

View File

@ -13,7 +13,6 @@
#include "InputCommon/ControllerEmu/Control/Control.h"
#include "InputCommon/ControllerEmu/Control/Input.h"
#include "InputCommon/ControllerEmu/ControllerEmu.h"
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
namespace ControllerEmu
{
@ -23,7 +22,7 @@ Slider::Slider(const std::string& name_, const std::string& ui_name_)
controls.emplace_back(std::make_unique<Input>(Translate, _trans("Left")));
controls.emplace_back(std::make_unique<Input>(Translate, _trans("Right")));
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
AddDeadzoneSetting(&m_deadzone_setting, 50);
}
Slider::Slider(const std::string& name_) : Slider(name_, name_)
@ -32,7 +31,7 @@ Slider::Slider(const std::string& name_) : Slider(name_, name_)
Slider::StateData Slider::GetState()
{
const ControlState deadzone = numeric_settings[0]->GetValue();
const ControlState deadzone = m_deadzone_setting.GetValue() / 100;
const ControlState state = controls[1]->control_ref->State() - controls[0]->control_ref->State();
if (fabs(state) > deadzone)