added toggle for mouse movement input (f7)

This commit is contained in:
kalaposfos13 2024-10-13 10:08:28 +02:00
parent 607514eb86
commit 6a2eab3f65

View File

@ -182,6 +182,7 @@ std::map<KeyBinding, AxisMapping> axis_map = {};
int mouse_joystick_binding = 0; int mouse_joystick_binding = 0;
Uint32 mouse_polling_id = 0; Uint32 mouse_polling_id = 0;
bool mouse_enabled = true;
void WindowSDL::parseInputConfig(const std::string& filename) { void WindowSDL::parseInputConfig(const std::string& filename) {
// Read configuration file. // Read configuration file.
@ -297,7 +298,7 @@ Uint32 WindowSDL::mousePolling(void* param, Uint32 id, Uint32 interval) {
} }
void WindowSDL::updateMouse() { void WindowSDL::updateMouse() {
if(!mouse_enabled) return;
Input::Axis axis_x, axis_y; Input::Axis axis_x, axis_y;
switch (mouse_joystick_binding) { switch (mouse_joystick_binding) {
case 1: case 1:
@ -497,6 +498,10 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
if (binding.key == SDLK_F8) { if (binding.key == SDLK_F8) {
parseInputConfig("keyboardInputConfig.ini"); parseInputConfig("keyboardInputConfig.ini");
} }
// Toggle mouse movement input
if (binding.key == SDLK_F7) {
mouse_enabled = !mouse_enabled;
}
// Toggle fullscreen // Toggle fullscreen
if (binding.key == SDLK_F11) { if (binding.key == SDLK_F11) {
SDL_WindowFlags flag = SDL_GetWindowFlags(window); SDL_WindowFlags flag = SDL_GetWindowFlags(window);