1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-12-20 12:58:06 +00:00

one more fix to touch control

This commit is contained in:
Zeno Rogue
2025-12-11 22:28:49 +01:00
parent a1e7ac289d
commit 6337519747

View File

@@ -1121,6 +1121,7 @@ EX void mainloopiter() {
if(((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_MMASK)) && !mouseout2()) if(((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_MMASK)) && !mouseout2())
currently_scrolling = true; currently_scrolling = true;
ui_mousex = mousex, ui_mousey = mousey;
#if SDLVER >= 2 #if SDLVER >= 2
if(timetowait > 0) { if(timetowait > 0) {
if(SDL_WaitEventTimeout(&ev, timetowait)) handle_event(ev); if(SDL_WaitEventTimeout(&ev, timetowait)) handle_event(ev);
@@ -1138,6 +1139,7 @@ EX void mainloopiter() {
} }
EX bool need_refresh; EX bool need_refresh;
EX int ui_mousex, ui_mousey;
EX void handle_event(SDL_Event& ev) { EX void handle_event(SDL_Event& ev) {
bool normal = cmode & sm::NORMAL; bool normal = cmode & sm::NORMAL;
@@ -1287,9 +1289,9 @@ EX void handle_event(SDL_Event& ev) {
if(ev.type == SDL_EVENT_MOUSE_BUTTON_DOWN && ev.button.which == 255) return; if(ev.type == SDL_EVENT_MOUSE_BUTTON_DOWN && ev.button.which == 255) return;
#endif #endif
if(ev.button.x != mousex || ev.button.y != mousey) { if(ev.button.x != ui_mousex || ev.button.y != ui_mousey) {
mousex = ev.button.x; mousex = pre_mousex = ev.button.x;
mousey = ev.button.y; mousey = pre_mousey = ev.button.y;
just_refreshing = true; just_refreshing = true;
reset_handlers(); reset_handlers();
screens.back()(); screens.back()();