hotkey: F7 toggle vsync + F8 next presentation mode amb notificacions

This commit is contained in:
2026-05-19 20:30:16 +02:00
parent 20325ddd5a
commit 74d96047c7
3 changed files with 26 additions and 1 deletions
+21
View File
@@ -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)) {
+3 -1
View File
@@ -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
+2
View File
@@ -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