diff --git a/source/core/input/global_inputs.cpp b/source/core/input/global_inputs.cpp index bdbfb06..3c2d48d 100644 --- a/source/core/input/global_inputs.cpp +++ b/source/core/input/global_inputs.cpp @@ -62,6 +62,17 @@ namespace GlobalInputs { Notifications::show(MSG, Notifications::Palette::TOGGLE, Notifications::LONG_MS); } + void notifyVSync() { + const std::string STATE = Options::video.vsync ? "ON" : "OFF"; + const std::string MSG = std::string("VSync ") + STATE; + Notifications::show(MSG, Notifications::Palette::TOGGLE, Notifications::STANDARD_MS); + } + + void notifyPresentationMode() { + const std::string MSG = std::string("Mode ") + Screen::getPresentationModeName(); + Notifications::show(MSG, Notifications::Palette::CHOICE, Notifications::STANDARD_MS); + } + void onExit() { const Uint32 NOW = SDL_GetTicks(); if (NOW < exit_window_until_ticks) { @@ -106,6 +117,16 @@ namespace GlobalInputs { notifyVersion(); return true; } + if (Input::get()->checkInput(Input::Action::TOGGLE_VSYNC, Input::Repeat::OFF)) { + Screen::get()->toggleVSync(); + notifyVSync(); + return true; + } + if (Input::get()->checkInput(Input::Action::NEXT_PRESENTATION_MODE, Input::Repeat::OFF)) { + Screen::get()->nextPresentationMode(); + notifyPresentationMode(); + return true; + } // F5/F6 només actuen quan el post-procesado està actiu. if (Screen::isShaderEnabled()) { if (Input::get()->checkInput(Input::Action::TOGGLE_SHADER_TYPE, Input::Repeat::OFF)) { diff --git a/source/core/input/input.h b/source/core/input/input.h index 20cf3b8..a441cd1 100644 --- a/source/core/input/input.h +++ b/source/core/input/input.h @@ -50,8 +50,10 @@ class Input { TOGGLE_SHADER, TOGGLE_SHADER_TYPE, - // Diagnostic + // Diagnostic / video toggles SHOW_VERSION, + TOGGLE_VSYNC, + NEXT_PRESENTATION_MODE, // Centinela final (usar para sizing) NUMBER_OF_INPUTS diff --git a/source/core/system/director.cpp b/source/core/system/director.cpp index 7649521..f4b0370 100644 --- a/source/core/system/director.cpp +++ b/source/core/system/director.cpp @@ -232,6 +232,8 @@ void Director::initInput() { Input::get()->bindKey(Input::Action::TOGGLE_SHADER, SDL_SCANCODE_F4); Input::get()->bindKey(Input::Action::TOGGLE_SHADER_TYPE, SDL_SCANCODE_F5); Input::get()->bindKey(Input::Action::NEXT_SHADER_PRESET, SDL_SCANCODE_F6); + Input::get()->bindKey(Input::Action::TOGGLE_VSYNC, SDL_SCANCODE_F7); + Input::get()->bindKey(Input::Action::NEXT_PRESENTATION_MODE, SDL_SCANCODE_F8); Input::get()->bindKey(Input::Action::SHOW_VERSION, SDL_SCANCODE_F11); // Mando - Movimiento del jugador