mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 16:52:46 +01:00
Merge pull request #5047 from german77/MouseInput
InputCommon: Fix implicit conversion in mouse input
This commit is contained in:
commit
d39dfdf45c
1 changed files with 8 additions and 6 deletions
|
@ -54,12 +54,13 @@ void Mouse::PressButton(int x, int y, int button_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int button = 1 << button_;
|
int button = 1 << button_;
|
||||||
|
const auto button_index = static_cast<std::size_t>(button_);
|
||||||
buttons |= static_cast<u16>(button);
|
buttons |= static_cast<u16>(button);
|
||||||
last_button = static_cast<MouseButton>(button_);
|
last_button = static_cast<MouseButton>(button_);
|
||||||
|
|
||||||
mouse_info[button_].mouse_origin = Common::MakeVec(x, y);
|
mouse_info[button_index].mouse_origin = Common::MakeVec(x, y);
|
||||||
mouse_info[button_].last_mouse_position = Common::MakeVec(x, y);
|
mouse_info[button_index].last_mouse_position = Common::MakeVec(x, y);
|
||||||
mouse_info[button_].data.pressed = true;
|
mouse_info[button_index].data.pressed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse::MouseMove(int x, int y) {
|
void Mouse::MouseMove(int x, int y) {
|
||||||
|
@ -86,11 +87,12 @@ void Mouse::ReleaseButton(int button_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int button = 1 << button_;
|
int button = 1 << button_;
|
||||||
|
const auto button_index = static_cast<std::size_t>(button_);
|
||||||
buttons &= static_cast<u16>(0xFF - button);
|
buttons &= static_cast<u16>(0xFF - button);
|
||||||
|
|
||||||
mouse_info[button_].tilt_speed = 0;
|
mouse_info[button_index].tilt_speed = 0;
|
||||||
mouse_info[button_].data.pressed = false;
|
mouse_info[button_index].data.pressed = false;
|
||||||
mouse_info[button_].data.axis = {0, 0};
|
mouse_info[button_index].data.axis = {0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse::BeginConfiguration() {
|
void Mouse::BeginConfiguration() {
|
||||||
|
|
Loading…
Reference in a new issue