diff options
author | german <german@thesoftwareartisans.com> | 2020-12-01 00:53:43 +0100 |
---|---|---|
committer | german <german@thesoftwareartisans.com> | 2020-12-01 04:48:18 +0100 |
commit | ece0ae2bfb07a4576c31b0f2270883c53e1bff45 (patch) | |
tree | 7b1e79f801adf94a11beab820f80ff068cb84081 | |
parent | Implement full mouse support (diff) | |
download | yuzu-ece0ae2bfb07a4576c31b0f2270883c53e1bff45.tar yuzu-ece0ae2bfb07a4576c31b0f2270883c53e1bff45.tar.gz yuzu-ece0ae2bfb07a4576c31b0f2270883c53e1bff45.tar.bz2 yuzu-ece0ae2bfb07a4576c31b0f2270883c53e1bff45.tar.lz yuzu-ece0ae2bfb07a4576c31b0f2270883c53e1bff45.tar.xz yuzu-ece0ae2bfb07a4576c31b0f2270883c53e1bff45.tar.zst yuzu-ece0ae2bfb07a4576c31b0f2270883c53e1bff45.zip |
-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_) { } int button = 1 << button_; + const auto button_index = static_cast<std::size_t>(button_); buttons |= static_cast<u16>(button); last_button = static_cast<MouseButton>(button_); - mouse_info[button_].mouse_origin = Common::MakeVec(x, y); - mouse_info[button_].last_mouse_position = Common::MakeVec(x, y); - mouse_info[button_].data.pressed = true; + mouse_info[button_index].mouse_origin = Common::MakeVec(x, y); + mouse_info[button_index].last_mouse_position = Common::MakeVec(x, y); + mouse_info[button_index].data.pressed = true; } void Mouse::MouseMove(int x, int y) { @@ -86,11 +87,12 @@ void Mouse::ReleaseButton(int button_) { } int button = 1 << button_; + const auto button_index = static_cast<std::size_t>(button_); buttons &= static_cast<u16>(0xFF - button); - mouse_info[button_].tilt_speed = 0; - mouse_info[button_].data.pressed = false; - mouse_info[button_].data.axis = {0, 0}; + mouse_info[button_index].tilt_speed = 0; + mouse_info[button_index].data.pressed = false; + mouse_info[button_index].data.axis = {0, 0}; } void Mouse::BeginConfiguration() { |