Input use GetKeyState instead of GetAsyncKeyState

This commit is contained in:
kit 2024-06-12 18:37:31 -04:00
parent 475248d99d
commit 45c6971a36

View file

@ -662,19 +662,19 @@ Point2i DisplayServerWindows::mouse_get_position() const {
BitField<MouseButtonMask> DisplayServerWindows::mouse_get_button_state() const { BitField<MouseButtonMask> DisplayServerWindows::mouse_get_button_state() const {
BitField<MouseButtonMask> last_button_state = 0; BitField<MouseButtonMask> last_button_state = 0;
if (GetAsyncKeyState(VK_LBUTTON) & (1 << 15)) { if (GetKeyState(VK_LBUTTON) & (1 << 15)) {
last_button_state.set_flag(MouseButtonMask::LEFT); last_button_state.set_flag(MouseButtonMask::LEFT);
} }
if (GetAsyncKeyState(VK_RBUTTON) & (1 << 15)) { if (GetKeyState(VK_RBUTTON) & (1 << 15)) {
last_button_state.set_flag(MouseButtonMask::RIGHT); last_button_state.set_flag(MouseButtonMask::RIGHT);
} }
if (GetAsyncKeyState(VK_MBUTTON) & (1 << 15)) { if (GetKeyState(VK_MBUTTON) & (1 << 15)) {
last_button_state.set_flag(MouseButtonMask::MIDDLE); last_button_state.set_flag(MouseButtonMask::MIDDLE);
} }
if (GetAsyncKeyState(VK_XBUTTON1) & (1 << 15)) { if (GetKeyState(VK_XBUTTON1) & (1 << 15)) {
last_button_state.set_flag(MouseButtonMask::MB_XBUTTON1); last_button_state.set_flag(MouseButtonMask::MB_XBUTTON1);
} }
if (GetAsyncKeyState(VK_XBUTTON2) & (1 << 15)) { if (GetKeyState(VK_XBUTTON2) & (1 << 15)) {
last_button_state.set_flag(MouseButtonMask::MB_XBUTTON2); last_button_state.set_flag(MouseButtonMask::MB_XBUTTON2);
} }