From 52278c5a4d64a6b09938c17fce26e3d401cd03fd Mon Sep 17 00:00:00 2001 From: thecozies <79979276+thecozies@users.noreply.github.com> Date: Tue, 30 Apr 2024 09:41:22 -0500 Subject: [PATCH] disable cursor movement threshold when controller is the primary input (#14) --- include/recomp_ui.h | 2 ++ src/ui/ui_config.cpp | 4 ++++ src/ui/ui_renderer.cpp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/include/recomp_ui.h b/include/recomp_ui.h index 3652ac7..fe70754 100644 --- a/include/recomp_ui.h +++ b/include/recomp_ui.h @@ -114,6 +114,8 @@ namespace recomp { }; PromptContext *get_prompt_context(void); + + bool get_cont_active(void); } #endif diff --git a/src/ui/ui_config.cpp b/src/ui/ui_config.cpp index 372cdeb..cda6254 100644 --- a/src/ui/ui_config.cpp +++ b/src/ui/ui_config.cpp @@ -191,6 +191,10 @@ void recomp::set_cont_or_kb(bool cont_interacted) { } } +bool recomp::get_cont_active() { + return cont_active; +} + void close_config_menu_impl() { recomp::save_config(); diff --git a/src/ui/ui_renderer.cpp b/src/ui/ui_renderer.cpp index e0e64d7..6dfe54e 100644 --- a/src/ui/ui_renderer.cpp +++ b/src/ui/ui_renderer.cpp @@ -1260,6 +1260,11 @@ void draw_hook(RT64::RenderCommandList* command_list, RT64::RenderFramebuffer* s } last_mouse_pos[0] = cur_event.motion.x; last_mouse_pos[1] = cur_event.motion.y; + + // if controller is the primary input, don't use mouse movement to allow cursor to reactivate + if (recomp::get_cont_active()) { + break; + } } // fallthrough case SDL_EventType::SDL_MOUSEBUTTONDOWN: