diff options
| author | 2020-12-01 09:40:46 -0500 | |
|---|---|---|
| committer | 2020-12-01 09:40:46 -0500 | |
| commit | d39dfdf45c1205b9afaf3927bcbe81b057995176 (patch) | |
| tree | 24a56c98498861abeab6c495e7d4b36c9450f576 /src/input_common/mouse/mouse_input.cpp | |
| parent | Merge pull request #5013 from ReinUsesLisp/vk-early-z (diff) | |
| parent | Fix implicit conversion in mouse input (diff) | |
| download | yuzu-d39dfdf45c1205b9afaf3927bcbe81b057995176.tar.gz yuzu-d39dfdf45c1205b9afaf3927bcbe81b057995176.tar.xz yuzu-d39dfdf45c1205b9afaf3927bcbe81b057995176.zip | |
Merge pull request #5047 from german77/MouseInput
InputCommon: Fix implicit conversion in mouse input
Diffstat (limited to 'src/input_common/mouse/mouse_input.cpp')
| -rw-r--r-- | src/input_common/mouse/mouse_input.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/input_common/mouse/mouse_input.cpp b/src/input_common/mouse/mouse_input.cpp index 3f4264caa..d0ee64ad7 100644 --- a/src/input_common/mouse/mouse_input.cpp +++ b/src/input_common/mouse/mouse_input.cpp | |||
| @@ -54,12 +54,13 @@ void Mouse::PressButton(int x, int y, int button_) { | |||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | int button = 1 << button_; | 56 | int button = 1 << button_; |
| 57 | const auto button_index = static_cast<std::size_t>(button_); | ||
| 57 | buttons |= static_cast<u16>(button); | 58 | buttons |= static_cast<u16>(button); |
| 58 | last_button = static_cast<MouseButton>(button_); | 59 | last_button = static_cast<MouseButton>(button_); |
| 59 | 60 | ||
| 60 | mouse_info[button_].mouse_origin = Common::MakeVec(x, y); | 61 | mouse_info[button_index].mouse_origin = Common::MakeVec(x, y); |
| 61 | mouse_info[button_].last_mouse_position = Common::MakeVec(x, y); | 62 | mouse_info[button_index].last_mouse_position = Common::MakeVec(x, y); |
| 62 | mouse_info[button_].data.pressed = true; | 63 | mouse_info[button_index].data.pressed = true; |
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | void Mouse::MouseMove(int x, int y) { | 66 | void Mouse::MouseMove(int x, int y) { |
| @@ -86,11 +87,12 @@ void Mouse::ReleaseButton(int button_) { | |||
| 86 | } | 87 | } |
| 87 | 88 | ||
| 88 | int button = 1 << button_; | 89 | int button = 1 << button_; |
| 90 | const auto button_index = static_cast<std::size_t>(button_); | ||
| 89 | buttons &= static_cast<u16>(0xFF - button); | 91 | buttons &= static_cast<u16>(0xFF - button); |
| 90 | 92 | ||
| 91 | mouse_info[button_].tilt_speed = 0; | 93 | mouse_info[button_index].tilt_speed = 0; |
| 92 | mouse_info[button_].data.pressed = false; | 94 | mouse_info[button_index].data.pressed = false; |
| 93 | mouse_info[button_].data.axis = {0, 0}; | 95 | mouse_info[button_index].data.axis = {0, 0}; |
| 94 | } | 96 | } |
| 95 | 97 | ||
| 96 | void Mouse::BeginConfiguration() { | 98 | void Mouse::BeginConfiguration() { |