From 6a2eab3f6586304365bf5499cd3186d5e68de93d Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Sun, 13 Oct 2024 10:08:28 +0200 Subject: [PATCH] added toggle for mouse movement input (f7) --- src/sdl_window.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 5410fa272..63444e93f 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -182,6 +182,7 @@ std::map axis_map = {}; int mouse_joystick_binding = 0; Uint32 mouse_polling_id = 0; +bool mouse_enabled = true; void WindowSDL::parseInputConfig(const std::string& filename) { // Read configuration file. @@ -297,7 +298,7 @@ Uint32 WindowSDL::mousePolling(void* param, Uint32 id, Uint32 interval) { } void WindowSDL::updateMouse() { - + if(!mouse_enabled) return; Input::Axis axis_x, axis_y; switch (mouse_joystick_binding) { case 1: @@ -497,6 +498,10 @@ void WindowSDL::onKeyPress(const SDL_Event* event) { if (binding.key == SDLK_F8) { parseInputConfig("keyboardInputConfig.ini"); } + // Toggle mouse movement input + if (binding.key == SDLK_F7) { + mouse_enabled = !mouse_enabled; + } // Toggle fullscreen if (binding.key == SDLK_F11) { SDL_WindowFlags flag = SDL_GetWindowFlags(window);