From 83b196a4e5c9c4463d3e5ca629e7b639647e8d8b Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Sat, 4 May 2024 15:42:19 -0400 Subject: [PATCH] Move rmlui reload to F10 and make F11 toggle fullscreen --- assets/config_menu/graphics.rml | 2 +- src/game/input.cpp | 9 ++++++++- src/ui/ui_renderer.cpp | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/assets/config_menu/graphics.rml b/assets/config_menu/graphics.rml index 6cc35d8..ea9dfb2 100644 --- a/assets/config_menu/graphics.rml +++ b/assets/config_menu/graphics.rml @@ -282,7 +282,7 @@ Sets the horizontal aspect ratio. Original uses the game's original 4:3 aspect ratio. Expand will adjust to match the game window's aspect ratio.

- Sets whether the game should display Windowed or Fullscreen. You can also use Alt + Enter to toggle this option. + Sets whether the game should display Windowed or Fullscreen. You can also use F11 or Alt + Enter to toggle this option.

Sets the game's output framerate. This option does not affect gameplay. diff --git a/src/game/input.cpp b/src/game/input.cpp index 32c170d..786536b 100644 --- a/src/game/input.cpp +++ b/src/game/input.cpp @@ -102,7 +102,14 @@ bool sdl_event_filter(void* userdata, SDL_Event* event) { { SDL_KeyboardEvent* keyevent = &event->key; - if (keyevent->keysym.scancode == SDL_Scancode::SDL_SCANCODE_RETURN && (keyevent->keysym.mod & SDL_Keymod::KMOD_ALT)) { + // Skip repeated events. + if (event->key.repeat) { + break; + } + + if ((keyevent->keysym.scancode == SDL_Scancode::SDL_SCANCODE_RETURN && (keyevent->keysym.mod & SDL_Keymod::KMOD_ALT)) || + keyevent->keysym.scancode == SDL_Scancode::SDL_SCANCODE_F11 + ) { recomp::toggle_fullscreen(); } if (scanning_device != recomp::InputDevice::COUNT) { diff --git a/src/ui/ui_renderer.cpp b/src/ui/ui_renderer.cpp index 79d2671..f62c992 100644 --- a/src/ui/ui_renderer.cpp +++ b/src/ui/ui_renderer.cpp @@ -1255,7 +1255,7 @@ void draw_hook(RT64::RenderCommandList* command_list, RT64::RenderFramebuffer* s const Uint8* key_state = SDL_GetKeyboardState(&num_keys); static bool was_reload_held = false; - bool is_reload_held = key_state[SDL_SCANCODE_F11] != 0; + bool is_reload_held = key_state[SDL_SCANCODE_F10] != 0; bool reload_sheets = is_reload_held && !was_reload_held; was_reload_held = is_reload_held;