summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon
diff options
context:
space:
mode:
authorAnthony <Helios747@users.noreply.github.com>2019-05-10 19:16:40 -0700
committerGitHub <noreply@github.com>2019-05-10 19:16:40 -0700
commit3ab06dcd02ea6040c2620a8ce8be144c65534c2d (patch)
treed695cb4bb2c7f9573c99ee91bfcc54bad81f98dc /Source/Core/InputCommon
parent46561cc242237c22fe24b6c990fbaeaba241f8fd (diff)
parent374585f12806886f9ad8b117dfc4811033dad4f3 (diff)
Merge pull request #8016 from jordan-woyak/emu-wm-ir-rename
WiimoteEmu/DolphinQt: Rename "IR" to "Point" and eliminate redundant Forward/Backward actions.
Diffstat (limited to 'Source/Core/InputCommon')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp9
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h5
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp23
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.h6
4 files changed, 13 insertions, 30 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp
index 4e4d515077..09370a1f0b 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp
@@ -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_)
{
}
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h
index 146dc16fcb..9383ec07f0 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h
@@ -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 = "",
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp
index 410cf87b33..5e69f0bca0 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp
@@ -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;
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.h
index 4b0d13eb6c..7c72120dba 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.h
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.h
@@ -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;