ajustat "al gust" el hud (consola, render info i notifier)
This commit is contained in:
@@ -80,10 +80,9 @@ void RenderInfo::render() const {
|
|||||||
|
|
||||||
// Constantes visuales (igual que Console)
|
// Constantes visuales (igual que Console)
|
||||||
static constexpr Uint8 BG_COLOR = 0; // PaletteColor::BLACK
|
static constexpr Uint8 BG_COLOR = 0; // PaletteColor::BLACK
|
||||||
static constexpr Uint8 BORDER_COLOR = 9; // PaletteColor::BRIGHT_GREEN
|
static constexpr Uint8 MSG_COLOR = 9; // PaletteColor::BRIGHT_GREEN
|
||||||
static constexpr Uint8 MSG_COLOR = 8; // PaletteColor::GREEN
|
|
||||||
static constexpr int TEXT_SIZE = 6;
|
static constexpr int TEXT_SIZE = 6;
|
||||||
static constexpr int PADDING_V = TEXT_SIZE / 2;
|
static constexpr int PADDING_V = TEXT_SIZE / 2 - 1;
|
||||||
|
|
||||||
// Fuente: preferir la de la consola si está disponible
|
// Fuente: preferir la de la consola si está disponible
|
||||||
auto text_obj = (Console::get() != nullptr) ? Console::get()->getText() : Screen::get()->getText();
|
auto text_obj = (Console::get() != nullptr) ? Console::get()->getText() : Screen::get()->getText();
|
||||||
@@ -100,7 +99,7 @@ void RenderInfo::render() const {
|
|||||||
|
|
||||||
auto game_surface = Screen::get()->getGameSurface();
|
auto game_surface = Screen::get()->getGameSurface();
|
||||||
game_surface->fillRect(&RECT, BG_COLOR);
|
game_surface->fillRect(&RECT, BG_COLOR);
|
||||||
game_surface->drawRectBorder(&RECT, BORDER_COLOR);
|
// game_surface->drawRectBorder(&RECT, BORDER_COLOR);
|
||||||
text_obj->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG,
|
text_obj->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG,
|
||||||
static_cast<int>(Options::game.width / 2),
|
static_cast<int>(Options::game.width / 2),
|
||||||
Y + PADDING_V,
|
Y + PADDING_V,
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ class RenderInfo {
|
|||||||
// Consultas
|
// Consultas
|
||||||
[[nodiscard]] auto isActive() const -> bool { return active_; }
|
[[nodiscard]] auto isActive() const -> bool { return active_; }
|
||||||
|
|
||||||
// Altura fija del overlay (TEXT_SIZE(6) + PADDING_V(3) * 2)
|
// Altura fija del overlay (TEXT_SIZE(6) + PADDING_V(2) * 2)
|
||||||
static constexpr int HEIGHT = 12;
|
static constexpr int HEIGHT = 10;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Singleton
|
// Singleton
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ static void printHelp() {
|
|||||||
SDL_Log(" SCENE [LOGO|LOADING|TITLE|CREDITS|GAME|ENDING|ENDING2|RESTART]");
|
SDL_Log(" SCENE [LOGO|LOADING|TITLE|CREDITS|GAME|ENDING|ENDING2|RESTART]");
|
||||||
SDL_Log(" KIOSK [ON] Enable kiosk mode");
|
SDL_Log(" KIOSK [ON] Enable kiosk mode");
|
||||||
SDL_Log(" EXIT / QUIT Quit application");
|
SDL_Log(" EXIT / QUIT Quit application");
|
||||||
|
SDL_Log(" SHOW NOTIFICATION Show a test notification");
|
||||||
SDL_Log(" HELP/? Show this help in terminal");
|
SDL_Log(" HELP/? Show this help in terminal");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,9 +299,13 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
|||||||
// DEBUG [ON|OFF] — Overlay de debug (F12, solo en builds debug)
|
// DEBUG [ON|OFF] — Overlay de debug (F12, solo en builds debug)
|
||||||
{.keyword = "DEBUG", .execute = BOOL_TOGGLE_CMD("Debug overlay", RenderInfo::get()->isActive(), RenderInfo::get()->toggle())},
|
{.keyword = "DEBUG", .execute = BOOL_TOGGLE_CMD("Debug overlay", RenderInfo::get()->isActive(), RenderInfo::get()->toggle())},
|
||||||
|
|
||||||
// SHOW FPS / HIDE FPS — Aliases de DEBUG ON / DEBUG OFF
|
// SHOW FPS / SHOW NOTIFICATION / HIDE FPS
|
||||||
{.keyword = "SHOW", .execute = [](const std::vector<std::string>& args) -> std::string {
|
{.keyword = "SHOW", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||||
if (args.empty() || args[0] != "FPS") { return "Usage: SHOW FPS"; }
|
if (!args.empty() && args[0] == "NOTIFICATION") {
|
||||||
|
Notifier::get()->show({"NOTIFICATION"});
|
||||||
|
return "Notification shown";
|
||||||
|
}
|
||||||
|
if (args.empty() || args[0] != "FPS") { return "Usage: SHOW [FPS|NOTIFICATION]"; }
|
||||||
if (RenderInfo::get()->isActive()) { return "Debug overlay already ON"; }
|
if (RenderInfo::get()->isActive()) { return "Debug overlay already ON"; }
|
||||||
RenderInfo::get()->toggle();
|
RenderInfo::get()->toggle();
|
||||||
return "Debug overlay ON";
|
return "Debug overlay ON";
|
||||||
|
|||||||
Reference in New Issue
Block a user