nova clase renderInfo

afegit control de offset a les notificacions
This commit is contained in:
2026-03-28 12:49:38 +01:00
parent f15658a767
commit 065f66d40e
12 changed files with 189 additions and 82 deletions

View File

@@ -14,7 +14,9 @@
#include "core/rendering/text.hpp" // Para Text
#include "core/resources/resource_cache.hpp" // Para Resource
#include "game/options.hpp" // Para Options
#include "core/rendering/render_info.hpp" // Para RenderInfo
#include "game/scene_manager.hpp" // Para SceneManager
#include "game/ui/notifier.hpp" // Para Notifier
// ── Sistema de comandos ────────────────────────────────────────────────────────
@@ -293,19 +295,19 @@ static const std::vector<ConsoleCommand> COMMANDS = {
#ifdef _DEBUG
// DEBUG [ON|OFF] — Overlay de debug (F12, solo en builds debug)
{.keyword = "DEBUG", .execute = BOOL_TOGGLE_CMD("Debug overlay",
Screen::get()->isFPSVisible(),
Screen::get()->toggleFPS())},
RenderInfo::get()->isActive(),
RenderInfo::get()->toggle())},
// SHOW FPS / HIDE FPS — Aliases de DEBUG ON / DEBUG OFF
{.keyword = "SHOW", .execute = [](const std::vector<std::string>& args) -> std::string {
if (args.empty() || args[0] != "FPS") { return "Usage: SHOW FPS"; }
if (Screen::get()->isFPSVisible()) { return "Debug overlay already ON"; }
Screen::get()->toggleFPS(); return "Debug overlay ON";
if (RenderInfo::get()->isActive()) { return "Debug overlay already ON"; }
RenderInfo::get()->toggle(); return "Debug overlay ON";
}},
{.keyword = "HIDE", .execute = [](const std::vector<std::string>& args) -> std::string {
if (args.empty() || args[0] != "FPS") { return "Usage: HIDE FPS"; }
if (!Screen::get()->isFPSVisible()) { return "Debug overlay already OFF"; }
Screen::get()->toggleFPS(); return "Debug overlay OFF";
if (!RenderInfo::get()->isActive()) { return "Debug overlay already OFF"; }
RenderInfo::get()->toggle(); return "Debug overlay OFF";
}},
#endif
@@ -629,6 +631,7 @@ void Console::toggle() {
cursor_timer_ = 0.0F;
cursor_visible_ = true;
SDL_StartTextInput(SDL_GetKeyboardFocus());
if (Notifier::get() != nullptr) { Notifier::get()->addYOffset(static_cast<int>(height_)); }
break;
case Status::ACTIVE:
status_ = Status::VANISHING;
@@ -636,6 +639,7 @@ void Console::toggle() {
history_index_ = -1;
saved_input_.clear();
SDL_StopTextInput(SDL_GetKeyboardFocus());
if (Notifier::get() != nullptr) { Notifier::get()->removeYOffset(static_cast<int>(height_)); }
break;
default:
// Durante RISING o VANISHING no se hace nada