mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
WiimoteEmu/DolphinQt: Rename "IR" to "Point" and eliminate redundant Forward/Backward mappings.
This commit is contained in:
@ -15,14 +15,13 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
ControlGroup::ControlGroup(const std::string& name_, const GroupType type_)
|
||||
: name(name_), ui_name(name_), type(type_)
|
||||
ControlGroup::ControlGroup(std::string name_, const GroupType type_)
|
||||
: name(name_), ui_name(std::move(name_)), type(type_)
|
||||
{
|
||||
}
|
||||
|
||||
ControlGroup::ControlGroup(const std::string& name_, const std::string& ui_name_,
|
||||
const GroupType type_)
|
||||
: name(name_), ui_name(ui_name_), type(type_)
|
||||
ControlGroup::ControlGroup(std::string name_, std::string ui_name_, const GroupType type_)
|
||||
: name(std::move(name_)), ui_name(std::move(ui_name_)), type(type_)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,8 @@ enum class GroupType
|
||||
class ControlGroup
|
||||
{
|
||||
public:
|
||||
explicit ControlGroup(const std::string& name, GroupType type = GroupType::Other);
|
||||
ControlGroup(const std::string& name, const std::string& ui_name,
|
||||
GroupType type = GroupType::Other);
|
||||
explicit ControlGroup(std::string name, GroupType type = GroupType::Other);
|
||||
ControlGroup(std::string name, std::string ui_name, GroupType type = GroupType::Other);
|
||||
virtual ~ControlGroup();
|
||||
|
||||
virtual void LoadConfig(IniFile::Section* sec, const std::string& defdev = "",
|
||||
|
@ -21,14 +21,13 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
Cursor::Cursor(const std::string& name_)
|
||||
: ReshapableInput(name_, name_, GroupType::Cursor), m_last_update(Clock::now())
|
||||
Cursor::Cursor(std::string name, std::string ui_name)
|
||||
: ReshapableInput(std::move(name), std::move(ui_name), GroupType::Cursor),
|
||||
m_last_update(Clock::now())
|
||||
{
|
||||
for (auto& named_direction : named_directions)
|
||||
controls.emplace_back(std::make_unique<Input>(Translate, named_direction));
|
||||
|
||||
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("Hide")));
|
||||
controls.emplace_back(std::make_unique<Input>(Translate, _trans("Recenter")));
|
||||
|
||||
@ -83,13 +82,11 @@ ControlState Cursor::GetGateRadiusAtAngle(double ang) const
|
||||
|
||||
Cursor::StateData Cursor::GetState(const bool adjusted)
|
||||
{
|
||||
ControlState z = controls[4]->control_ref->State() - controls[5]->control_ref->State();
|
||||
|
||||
if (!adjusted)
|
||||
{
|
||||
const auto raw_input = GetReshapableState(false);
|
||||
|
||||
return {raw_input.x, raw_input.y, z};
|
||||
return {raw_input.x, raw_input.y};
|
||||
}
|
||||
|
||||
const auto input = GetReshapableState(true);
|
||||
@ -102,20 +99,12 @@ Cursor::StateData Cursor::GetState(const bool adjusted)
|
||||
m_last_update = now;
|
||||
|
||||
const double max_step = STEP_PER_SEC / 1000.0 * ms_since_update;
|
||||
const double max_z_step = STEP_Z_PER_SEC / 1000.0 * ms_since_update;
|
||||
|
||||
// Apply deadzone to z:
|
||||
z = ApplyDeadzone(z, GetDeadzonePercentage());
|
||||
|
||||
// Smooth out z movement:
|
||||
// FYI: Not using relative input for Z.
|
||||
m_state.z += std::clamp(z - m_state.z, -max_z_step, max_z_step);
|
||||
|
||||
// Relative input:
|
||||
if (m_relative_setting.GetValue())
|
||||
{
|
||||
// Recenter:
|
||||
if (controls[7]->control_ref->State() > BUTTON_THRESHOLD)
|
||||
if (controls[5]->control_ref->State() > BUTTON_THRESHOLD)
|
||||
{
|
||||
m_state.x = 0.0;
|
||||
m_state.y = 0.0;
|
||||
@ -152,7 +141,7 @@ Cursor::StateData Cursor::GetState(const bool adjusted)
|
||||
m_prev_result = result;
|
||||
|
||||
// If auto-hide time is up or hide button is held:
|
||||
if (!m_auto_hide_timer || controls[6]->control_ref->State() > BUTTON_THRESHOLD)
|
||||
if (!m_auto_hide_timer || controls[4]->control_ref->State() > BUTTON_THRESHOLD)
|
||||
{
|
||||
result.x = std::numeric_limits<ControlState>::quiet_NaN();
|
||||
result.y = 0;
|
||||
|
@ -19,12 +19,11 @@ public:
|
||||
{
|
||||
ControlState x{};
|
||||
ControlState y{};
|
||||
ControlState z{};
|
||||
|
||||
bool IsVisible() const;
|
||||
};
|
||||
|
||||
explicit Cursor(const std::string& name);
|
||||
Cursor(std::string name, std::string ui_name);
|
||||
|
||||
ReshapeData GetReshapableState(bool adjusted) final override;
|
||||
ControlState GetGateRadiusAtAngle(double ang) const override;
|
||||
@ -45,9 +44,6 @@ private:
|
||||
// to something that makes sense with the default range.
|
||||
static constexpr double STEP_PER_SEC = 0.01 * 200;
|
||||
|
||||
// Smooth out forward/backward movements:
|
||||
static constexpr double STEP_Z_PER_SEC = 0.05 * 200;
|
||||
|
||||
static constexpr int AUTO_HIDE_MS = 2500;
|
||||
static constexpr double AUTO_HIDE_DEADZONE = 0.001;
|
||||
|
||||
|
Reference in New Issue
Block a user