- afegides les habitacions de tot el joc (buides)

- minimapa mostra els numeros d'habitacio
- tecla per a fer captures de pantalla
This commit is contained in:
2026-04-12 10:25:12 +02:00
parent c1764ba0d8
commit 234ae82f56
124 changed files with 7744 additions and 35 deletions

View File

@@ -7,8 +7,9 @@
#include "core/input/input.hpp" // Para Input, InputAction, Input::DO_NOT_ALLOW_REPEAT
#include "core/locale/locale.hpp" // Para Locale
#include "core/rendering/render_info.hpp" // Para RenderInfo
#include "core/rendering/screen.hpp" // Para Screen
#include "core/rendering/render_info.hpp" // Para RenderInfo
#include "core/rendering/screen.hpp" // Para Screen
#include "core/rendering/screenshot.hpp" // Para Screenshot
#ifdef _DEBUG
#include "core/system/debug.hpp" // Para Debug (persistencia de render_info en debug.yaml)
#endif
@@ -124,6 +125,17 @@ namespace GlobalInputs {
Notifier::get()->show({Locale::get()->get("ui.palette") + " " + toUpper(Screen::get()->getPalettePrettyName())});
}
void handleScreenshot() {
std::vector<Uint32> buffer;
int width = 0;
int height = 0;
Screen::get()->captureComposite(buffer, width, height);
std::string filename = Screenshot::save(buffer.data(), width, height);
if (!filename.empty()) {
Notifier::get()->show({filename});
}
}
void handleNextPaletteSortMode() {
Screen::get()->nextPaletteSortMode();
Notifier::get()->show({Locale::get()->get("ui.palette_sort") + " " + toUpper(Screen::get()->getPaletteSortModeName())});
@@ -194,6 +206,10 @@ namespace GlobalInputs {
if (Input::get()->checkAction(InputAction::TOGGLE_CONSOLE, Input::DO_NOT_ALLOW_REPEAT)) {
return InputAction::TOGGLE_CONSOLE;
}
if (Input::get()->checkAction(InputAction::SCREENSHOT, Input::DO_NOT_ALLOW_REPEAT) &&
((SDL_GetModState() & SDL_KMOD_CTRL) != 0U)) {
return InputAction::SCREENSHOT;
}
return InputAction::NONE;
}
@@ -294,6 +310,10 @@ namespace GlobalInputs {
if (Console::get() != nullptr) { Console::get()->toggle(); }
break;
case InputAction::SCREENSHOT:
handleScreenshot();
break;
case InputAction::TOGGLE_INFO:
if (RenderInfo::get() != nullptr) {
// Leemos la intención antes del toggle: isActive() incluye la

View File

@@ -53,7 +53,8 @@ Input::Input(std::string game_controller_db_path)
{Action::TOGGLE_VSYNC, KeyState{.scancode = SDL_SCANCODE_F10}},
{Action::PAUSE, KeyState{.scancode = SDL_SCANCODE_F11}},
{Action::TOGGLE_INFO, KeyState{.scancode = SDL_SCANCODE_F12}},
{Action::TOGGLE_CONSOLE, KeyState{.scancode = SDL_SCANCODE_GRAVE}}};
{Action::TOGGLE_CONSOLE, KeyState{.scancode = SDL_SCANCODE_GRAVE}},
{Action::SCREENSHOT, KeyState{.scancode = SDL_SCANCODE_S}}};
initSDLGamePad(); // Inicializa el subsistema SDL_INIT_GAMEPAD
}

View File

@@ -25,6 +25,7 @@ const std::unordered_map<InputAction, std::string> ACTION_TO_STRING = {
{InputAction::TOGGLE_SHADER, "TOGGLE_POSTFX"},
{InputAction::NEXT_SHADER_PRESET, "NEXT_POSTFX_PRESET"},
{InputAction::TOGGLE_INFO, "TOGGLE_DEBUG"},
{InputAction::SCREENSHOT, "SCREENSHOT"},
{InputAction::NONE, "NONE"}};
const std::unordered_map<std::string, InputAction> STRING_TO_ACTION = {
@@ -49,6 +50,7 @@ const std::unordered_map<std::string, InputAction> STRING_TO_ACTION = {
{"TOGGLE_POSTFX", InputAction::TOGGLE_SHADER},
{"NEXT_POSTFX_PRESET", InputAction::NEXT_SHADER_PRESET},
{"TOGGLE_DEBUG", InputAction::TOGGLE_INFO},
{"SCREENSHOT", InputAction::SCREENSHOT},
{"NONE", InputAction::NONE}};
const std::unordered_map<SDL_GamepadButton, std::string> BUTTON_TO_STRING = {

View File

@@ -36,6 +36,7 @@ enum class InputAction : std::uint8_t { // Acciones de entrada posibles en el j
NEXT_PALETTE_SORT,
TOGGLE_INFO,
TOGGLE_CONSOLE,
SCREENSHOT,
// Input obligatorio
NONE,