From fdb85ac3936a7497bd481738bd50350209e3d86e Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sat, 8 Mar 2025 10:54:44 +0100 Subject: [PATCH] Afegida tecla per a canviar el escalat sencer --- README.md | 8 +++++--- source/director.cpp | 3 ++- source/game.cpp | 8 ++++---- source/global_inputs.cpp | 8 ++++++++ source/input.h | 1 + 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5903315..f92a9d9 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,11 @@ El joc permet tant l'ús del teclat com d'un comandament. Les tecles per a jugar - **Tecla F1**: Disminueix la mida de la finestra. - **Tecla F2**: Augmenta la mida de la finestra. - **Tecla F3**: Alterna entre el mode de pantalla completa i el mode finestra. -- **Tecla F4**: Activa o desactiva els shaders -- **Tecla F5**: Canvia la paleta de colors del joc. -- **Tecla B**: Activa o desactiva el marge de colors en mode finestra. +- **Tecla F4**: Activa o desactiva els shaders. +- **Tecla F5**: Estableix la següent paleta de colors. +- **Tecla F6**: Estableix la paleta de colors prèvia. +- **Tecla F7**: Activa o desactiva el escalat exacte. +- **Tecla B**: Activa o desactiva el marge de colors. ![JailDoctor's Dilemma - Gameplay](https://php.sustancia.synology.me/images/jdd/jdd_game2.png) diff --git a/source/director.cpp b/source/director.cpp index 51278a5..d5d3a43 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -77,6 +77,7 @@ Director::Director(int argc, const char *argv[]) // Crea los objetos Screen::init(window_, renderer_); + SDL_ShowCursor(SDL_DISABLE); Resource::init(); Notifier::init("", "8bithud"); Screen::get()->setNotificationsEnabled(true); @@ -84,7 +85,6 @@ Director::Director(int argc, const char *argv[]) initInput(); Debug::init(); Cheevos::init(Asset::get()->get("cheevos.bin")); - SDL_ShowCursor(SDL_DISABLE); } Director::~Director() @@ -247,6 +247,7 @@ void Director::initInput() Input::get()->bindKey(InputAction::TOGGLE_SHADERS, SDL_SCANCODE_F4); Input::get()->bindKey(InputAction::NEXT_PALETTE, SDL_SCANCODE_F5); Input::get()->bindKey(InputAction::PREVIOUS_PALETTE, SDL_SCANCODE_F6); + Input::get()->bindKey(InputAction::TOGGLE_INTEGER_SCALE, SDL_SCANCODE_F7); Input::get()->bindKey(InputAction::TOGGLE_MUSIC, SDL_SCANCODE_M); Input::get()->bindKey(InputAction::TOGGLE_BORDER, SDL_SCANCODE_B); diff --git a/source/game.cpp b/source/game.cpp index f310d44..c53cc35 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -266,15 +266,15 @@ void Game::checkDebugEvents(const SDL_Event &event) changeRoom(room_->getRoom(BORDER_RIGHT)); break; - case SDL_SCANCODE_F7: - Notifier::get()->show({"ACHIEVEMENT UNLOCKED!", "I LIKE MY MULTICOLOURED FRIENDS"}, NotificationText::LEFT, 3, false, "F7"); + case SDL_SCANCODE_7: + Notifier::get()->show({"ACHIEVEMENT UNLOCKED!", "I LIKE MY MULTICOLOURED FRIENDS"}, NotificationText::CENTER, -1, false, "F7"); break; - case SDL_SCANCODE_F8: + case SDL_SCANCODE_8: Notifier::get()->show({"JAILDESIGNER", "IS LOGGED IN"}, NotificationText::LEFT, 4, false); break; - case SDL_SCANCODE_F9: + case SDL_SCANCODE_9: Notifier::get()->show({"JAILDESIGNER", "IS LOGGED IN"}, NotificationText::LEFT, 5, false); break; default: diff --git a/source/global_inputs.cpp b/source/global_inputs.cpp index 38d60e9..13385c5 100644 --- a/source/global_inputs.cpp +++ b/source/global_inputs.cpp @@ -104,5 +104,13 @@ namespace globalInputs Screen::get()->previousPalette(); Notifier::get()->show({"PALETTE " + options.video.palette}, NotificationText::CENTER); } + + else if (Input::get()->checkInput(InputAction::TOGGLE_INTEGER_SCALE, REPEAT_FALSE)) + { + options.video.integer_scale = !options.video.integer_scale; + SDL_RenderSetIntegerScale(Screen::get()->getRenderer(), options.video.integer_scale ? SDL_TRUE : SDL_FALSE); + Screen::get()->setVideoMode(options.video.mode); + Notifier::get()->show({"INTEGER SCALE " + std::string(options.video.integer_scale ? "ENABLED" : "DISABLED")}, NotificationText::CENTER); + } } } \ No newline at end of file diff --git a/source/input.h b/source/input.h index 4e74ae6..963aaaf 100644 --- a/source/input.h +++ b/source/input.h @@ -33,6 +33,7 @@ enum class InputAction WINDOW_INC_ZOOM, WINDOW_DEC_ZOOM, TOGGLE_VIDEOMODE, + TOGGLE_INTEGER_SCALE, TOGGLE_BORDER, TOGGLE_MUSIC, NEXT_PALETTE,