diff options
author | Lioncash <mathew1800@gmail.com> | 2020-10-14 08:51:14 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-10-16 01:37:51 +0200 |
commit | 046c0c91a3ed665531f20955e7cfb86fe5b73213 (patch) | |
tree | 94382af9cc339cf5f384f4d0c8938dd593b4e1c5 /src/input_common/analog_from_button.cpp | |
parent | Merge pull request #4787 from lioncash/conversion (diff) | |
download | yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.tar yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.tar.gz yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.tar.bz2 yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.tar.lz yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.tar.xz yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.tar.zst yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.zip |
Diffstat (limited to '')
-rwxr-xr-x | src/input_common/analog_from_button.cpp | 18 |
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: constexpr float SQRT_HALF = 0.707106781f; int x = 0, y = 0; - if (right->GetStatus()) + if (right->GetStatus()) { ++x; - if (left->GetStatus()) + } + if (left->GetStatus()) { --x; - if (up->GetStatus()) + } + if (up->GetStatus()) { ++y; - if (down->GetStatus()) + } + if (down->GetStatus()) { --y; + } - float coef = modifier->GetStatus() ? modifier_scale : 1.0f; - return std::make_tuple(x * coef * (y == 0 ? 1.0f : SQRT_HALF), - y * coef * (x == 0 ? 1.0f : SQRT_HALF)); + const float coef = modifier->GetStatus() ? modifier_scale : 1.0f; + return std::make_tuple(static_cast<float>(x) * coef * (y == 0 ? 1.0f : SQRT_HALF), + static_cast<float>(y) * coef * (x == 0 ? 1.0f : SQRT_HALF)); } bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override { |