diff options
| author | 2020-10-15 20:59:34 -0700 | |
|---|---|---|
| committer | 2020-10-15 20:59:34 -0700 | |
| commit | 64f967fd4958abb5a02191a81e91fc8b33bcf4c5 (patch) | |
| tree | 97a73da4871f006b39eafca3a881ae2ea42f206a /src/input_common/analog_from_button.cpp | |
| parent | Merge pull request #4784 from bunnei/cancelbuffer (diff) | |
| parent | input_common/CMakeLists: Make some warnings errors (diff) | |
| download | yuzu-64f967fd4958abb5a02191a81e91fc8b33bcf4c5.tar.gz yuzu-64f967fd4958abb5a02191a81e91fc8b33bcf4c5.tar.xz yuzu-64f967fd4958abb5a02191a81e91fc8b33bcf4c5.zip | |
Merge pull request #4790 from lioncash/input-common
input_common/CMakeLists: Make some warnings errors
Diffstat (limited to 'src/input_common/analog_from_button.cpp')
| -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: | |||
| 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 { |