summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/StickGate.cpp
diff options
context:
space:
mode:
authorFiloppi <filippotarpini@hotmail.it>2021-05-04 23:50:23 +0300
committerFiloppi <filippotarpini@hotmail.it>2021-05-12 18:27:23 +0300
commitf4fec42165f245e8ad35456a25bfada8428ba1f2 (patch)
treeb0e89930e9767368778c7a4b3cc4da56da243035 /Source/Core/InputCommon/ControllerEmu/StickGate.cpp
parente9e41b925b6efeac4d3eadf049391ef81483528f (diff)
Add mixed comments to input code, make some tooltip clearer
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/StickGate.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/StickGate.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp
index d1b230c373..60a3c062bd 100644
--- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp
@@ -128,6 +128,7 @@ std::optional<u32> SquareStickGate::GetIdealCalibrationSampleCount() const
ReshapableInput::ReshapableInput(std::string name_, std::string ui_name_, GroupType type_)
: ControlGroup(std::move(name_), std::move(ui_name_), type_)
{
+ // 50 is not always enough but users can set it to more with an expression
AddDeadzoneSetting(&m_deadzone_setting, 50);
}
@@ -285,6 +286,10 @@ ReshapableInput::ReshapeData ReshapableInput::Reshape(ControlState x, ControlSta
x -= m_center.x;
y -= m_center.y;
+ // We run this even if both x and y will be zero.
+ // In that case, std::atan2(0, 0) returns a valid non-NaN value, but the exact value
+ // (which depends on the signs of x and y) does not matter here as dist is zero
+
// TODO: make the AtAngle functions work with negative angles:
ControlState angle = std::atan2(y, x) + MathUtil::TAU;