summaryrefslogtreecommitdiff
path: root/src/input_common/analog_from_button.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2020-10-14 02:51:14 -0400
committerGravatar Lioncash2020-10-15 19:37:51 -0400
commit046c0c91a3ed665531f20955e7cfb86fe5b73213 (patch)
tree94382af9cc339cf5f384f4d0c8938dd593b4e1c5 /src/input_common/analog_from_button.cpp
parentMerge pull request #4787 from lioncash/conversion (diff)
downloadyuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.tar.gz
yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.tar.xz
yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.zip
input_common/CMakeLists: Make some warnings errors
Makes the input_common code warnings consistent with the rest of the codebase.
Diffstat (limited to 'src/input_common/analog_from_button.cpp')
-rwxr-xr-xsrc/input_common/analog_from_button.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/input_common/analog_from_button.cpp b/src/input_common/analog_from_button.cpp
index 6cabdaa3c..74744d7f3 100755
--- a/src/input_common/analog_from_button.cpp
+++ b/src/input_common/analog_from_button.cpp
@@ -20,18 +20,22 @@ public:
20 constexpr float SQRT_HALF = 0.707106781f; 20 constexpr float SQRT_HALF = 0.707106781f;
21 int x = 0, y = 0; 21 int x = 0, y = 0;
22 22
23 if (right->GetStatus()) 23 if (right->GetStatus()) {
24 ++x; 24 ++x;
25 if (left->GetStatus()) 25 }
26 if (left->GetStatus()) {
26 --x; 27 --x;
27 if (up->GetStatus()) 28 }
29 if (up->GetStatus()) {
28 ++y; 30 ++y;
29 if (down->GetStatus()) 31 }
32 if (down->GetStatus()) {
30 --y; 33 --y;
34 }
31 35
32 float coef = modifier->GetStatus() ? modifier_scale : 1.0f; 36 const float coef = modifier->GetStatus() ? modifier_scale : 1.0f;
33 return std::make_tuple(x * coef * (y == 0 ? 1.0f : SQRT_HALF), 37 return std::make_tuple(static_cast<float>(x) * coef * (y == 0 ? 1.0f : SQRT_HALF),
34 y * coef * (x == 0 ? 1.0f : SQRT_HALF)); 38 static_cast<float>(y) * coef * (x == 0 ? 1.0f : SQRT_HALF));
35 } 39 }
36 40
37 bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override { 41 bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override {