feat(title): cosmètics i posicions a YAML, font Tiny5 al copyright
This commit is contained in:
1 parent
233fcb8226
commit
fceeb11cdd
12 files changed
+211
-163
No files matched your search
@@ -200,7 +200,7 @@ Director::Director() {
|
||||
placeholder_text->setDefaultKerning(UiConfig::get().placeholderFont().kerning);
|
||||
placeholder_text_ = placeholder_text;
|
||||
|
||||
// Font del copyright de la TITLE (PixeloidSans-Bold). Pixel-art
|
||||
// Font del copyright de la TITLE (Tiny5-Regular size 8). Pixel-art
|
||||
// estricte; va amb la paleta UI per compartir índex de color amb la
|
||||
// resta de textos placeholder.
|
||||
const std::string COPYRIGHT_FONT_GIF_KEY = UiConfig::get().copyrightFont().name + ".gif";
|
||||
|
||||
@@ -100,6 +100,11 @@ UiConfig::UiConfig()
|
||||
title_bg_color_(Defaults::UI::Title::BG_COLOR),
|
||||
title_text_color_(Defaults::UI::Title::TEXT_COLOR),
|
||||
title_copyright_color_(Defaults::UI::Title::COPYRIGHT_COLOR),
|
||||
title_press_start_outline_color_(Defaults::UI::Title::PRESS_START_OUTLINE_COLOR),
|
||||
title_logo_y_percent_(Defaults::UI::Title::LOGO_Y_PERCENT),
|
||||
title_prompt_y_percent_(Defaults::UI::Title::PROMPT_Y_PERCENT),
|
||||
title_copyright_y_percent_(Defaults::UI::Title::COPYRIGHT_Y_PERCENT),
|
||||
title_mini_logo_gap_px_(Defaults::UI::Title::MINI_LOGO_GAP_PX),
|
||||
title_blink_visible_ms_(Defaults::UI::Title::BLINK_VISIBLE_MS),
|
||||
title_blink_hidden_ms_(Defaults::UI::Title::BLINK_HIDDEN_MS),
|
||||
title_starting_ms_(Defaults::UI::Title::STARTING_MS),
|
||||
@@ -233,6 +238,11 @@ void UiConfig::load(const std::string& file_path) {
|
||||
readColorIndex(t, "bg_color", title_bg_color_);
|
||||
readColorIndex(t, "text_color", title_text_color_);
|
||||
readColorIndex(t, "copyright_color", title_copyright_color_);
|
||||
readColorIndex(t, "press_start_outline_color", title_press_start_outline_color_);
|
||||
readField(t, "logo_y_percent", title_logo_y_percent_);
|
||||
readField(t, "prompt_y_percent", title_prompt_y_percent_);
|
||||
readField(t, "copyright_y_percent", title_copyright_y_percent_);
|
||||
readField(t, "mini_logo_gap_px", title_mini_logo_gap_px_);
|
||||
readField(t, "blink_visible_ms", title_blink_visible_ms_);
|
||||
readField(t, "blink_hidden_ms", title_blink_hidden_ms_);
|
||||
readField(t, "starting_ms", title_starting_ms_);
|
||||
|
||||
@@ -93,6 +93,11 @@ class UiConfig {
|
||||
[[nodiscard]] auto titleBgColor() const -> Uint8 { return title_bg_color_; }
|
||||
[[nodiscard]] auto titleTextColor() const -> Uint8 { return title_text_color_; }
|
||||
[[nodiscard]] auto titleCopyrightColor() const -> Uint8 { return title_copyright_color_; }
|
||||
[[nodiscard]] auto titlePressStartOutlineColor() const -> Uint8 { return title_press_start_outline_color_; }
|
||||
[[nodiscard]] auto titleLogoYPercent() const -> int { return title_logo_y_percent_; }
|
||||
[[nodiscard]] auto titlePromptYPercent() const -> int { return title_prompt_y_percent_; }
|
||||
[[nodiscard]] auto titleCopyrightYPercent() const -> int { return title_copyright_y_percent_; }
|
||||
[[nodiscard]] auto titleMiniLogoGapPx() const -> int { return title_mini_logo_gap_px_; }
|
||||
[[nodiscard]] auto titleBlinkVisibleMs() const -> int { return title_blink_visible_ms_; }
|
||||
[[nodiscard]] auto titleBlinkHiddenMs() const -> int { return title_blink_hidden_ms_; }
|
||||
[[nodiscard]] auto titleStartingMs() const -> int { return title_starting_ms_; }
|
||||
@@ -174,6 +179,11 @@ class UiConfig {
|
||||
Uint8 title_bg_color_;
|
||||
Uint8 title_text_color_;
|
||||
Uint8 title_copyright_color_;
|
||||
Uint8 title_press_start_outline_color_;
|
||||
int title_logo_y_percent_;
|
||||
int title_prompt_y_percent_;
|
||||
int title_copyright_y_percent_;
|
||||
int title_mini_logo_gap_px_;
|
||||
int title_blink_visible_ms_;
|
||||
int title_blink_hidden_ms_;
|
||||
int title_starting_ms_;
|
||||
|
||||
@@ -32,11 +32,6 @@ namespace {
|
||||
// docs/audit-core-rendering.md).
|
||||
const char* const SCENE_NAME = "TITLE";
|
||||
|
||||
constexpr int TITLE_Y_PERCENT = 25;
|
||||
constexpr int PROMPT_Y_PERCENT = 60;
|
||||
constexpr int COPYRIGHT_Y_PERCENT = 90;
|
||||
constexpr int LOGO_GAP_PX = 2; // Separació vertical entre el minilogo i el text de copyright.
|
||||
|
||||
// Detecta una pulsació de START dins el frame actual per al jugador
|
||||
// indicat. Combina events de teclat (scancode hardcoded a Defaults::
|
||||
// KeysGame[P2]) i events de gamepad (botó remapejable via
|
||||
@@ -259,7 +254,7 @@ void TitleScene::render() {
|
||||
}
|
||||
|
||||
const Uint8 TEXT_COLOR = ui_config.titleTextColor();
|
||||
const Uint8 OUTLINE_COLOR = ui_config.titleCopyrightColor();
|
||||
const Uint8 OUTLINE_COLOR = ui_config.titlePressStartOutlineColor();
|
||||
constexpr Uint8 OUTLINE_DIST = 1;
|
||||
constexpr Uint8 STROKE4 = Text::CENTER_FLAG | Text::COLOR_FLAG | Text::STROKE4_FLAG;
|
||||
|
||||
@@ -268,7 +263,7 @@ void TitleScene::render() {
|
||||
// la primera línia del text. Substitueix els dos `display_font_`
|
||||
// que pintaven "Aventures en Egipte" + "A R C A D E".
|
||||
if (game_logo_) {
|
||||
const int LOGO_Y = (GameCanvas::HEIGHT * TITLE_Y_PERCENT) / 100;
|
||||
const int LOGO_Y = (GameCanvas::HEIGHT * ui_config.titleLogoYPercent()) / 100;
|
||||
const int LOGO_X = GameCanvas::CENTER_X - (game_logo_->getWidth() / 2);
|
||||
game_logo_->render(LOGO_X, LOGO_Y);
|
||||
}
|
||||
@@ -290,7 +285,7 @@ void TitleScene::render() {
|
||||
const bool VISIBLE = (cycle_ms == 0) || ((blink_elapsed_ms_ % cycle_ms) < visible_ms);
|
||||
|
||||
if (VISIBLE) {
|
||||
const int PROMPT_Y = (GameCanvas::HEIGHT * PROMPT_Y_PERCENT) / 100;
|
||||
const int PROMPT_Y = (GameCanvas::HEIGHT * ui_config.titlePromptYPercent()) / 100;
|
||||
condensed_font_->writeDX(STROKE4,
|
||||
GameCanvas::CENTER_X,
|
||||
PROMPT_Y,
|
||||
@@ -303,15 +298,16 @@ void TitleScene::render() {
|
||||
}
|
||||
|
||||
// Footer: minilogo centrat horitzontalment damunt del © de
|
||||
// copyright. El text va al 90% Y, el logo just damunt amb un petit
|
||||
// gap (LOGO_GAP_PX). El copyright fa servir una font pixel-art
|
||||
// pròpia (PixeloidSans-Bold) — més neta i petita que la del
|
||||
// "press start" perquè la jerarquia tipogràfica del peu quedi clara.
|
||||
// copyright. El text va al `title.copyright_y_percent`, el logo just
|
||||
// damunt amb un petit gap (`title.mini_logo_gap_px`). El copyright fa
|
||||
// servir una font pixel-art pròpia (Tiny5-Regular size 8) — més neta
|
||||
// i petita que la del "press start" perquè la jerarquia tipogràfica
|
||||
// del peu quedi clara.
|
||||
if (copyright_font_) {
|
||||
const int COPY_Y = (GameCanvas::HEIGHT * COPYRIGHT_Y_PERCENT) / 100;
|
||||
const int COPY_Y = (GameCanvas::HEIGHT * ui_config.titleCopyrightYPercent()) / 100;
|
||||
if (mini_logo_) {
|
||||
const int LOGO_X = GameCanvas::CENTER_X - (mini_logo_->getWidth() / 2);
|
||||
const int LOGO_Y = COPY_Y - mini_logo_->getHeight() - LOGO_GAP_PX;
|
||||
const int LOGO_Y = COPY_Y - mini_logo_->getHeight() - ui_config.titleMiniLogoGapPx();
|
||||
mini_logo_->render(LOGO_X, LOGO_Y);
|
||||
}
|
||||
copyright_font_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG,
|
||||
|
||||
@@ -158,13 +158,13 @@ namespace Defaults {
|
||||
constexpr int MENU_ITEMS_KERNING = 0;
|
||||
|
||||
// Copyright al peu de la TITLE: pixel-art estricte, generat amb
|
||||
// font-gen a partir de PixeloidSans-Bold size 9. La separem
|
||||
// de la `placeholder` (que la fa servir el "press start") per
|
||||
// diferenciar tipogràficament jerarquia: prompt destacat amb
|
||||
// outline gros, copyright net i petit a baix.
|
||||
constexpr const char* COPYRIGHT_NAME = "PixeloidSans-Bold";
|
||||
constexpr const char* COPYRIGHT_GIF = "data/fonts/PixeloidSans-Bold.gif";
|
||||
constexpr const char* COPYRIGHT_FNT = "data/fonts/PixeloidSans-Bold.fnt";
|
||||
// font-gen a partir de Tiny5-Regular size 5 (caixa 3×6 px). La
|
||||
// separem de la `placeholder` (que la fa servir el "press start")
|
||||
// per diferenciar tipogràficament jerarquia: prompt destacat amb
|
||||
// outline gros, copyright net i micro a baix.
|
||||
constexpr const char* COPYRIGHT_NAME = "Tiny5-Regular";
|
||||
constexpr const char* COPYRIGHT_GIF = "data/fonts/Tiny5-Regular.gif";
|
||||
constexpr const char* COPYRIGHT_FNT = "data/fonts/Tiny5-Regular.fnt";
|
||||
constexpr int COPYRIGHT_KERNING = 0;
|
||||
} // namespace Font
|
||||
|
||||
@@ -271,7 +271,22 @@ namespace Defaults {
|
||||
constexpr int DURATION_MS = 30000;
|
||||
constexpr Uint8 BG_COLOR = 1;
|
||||
constexpr Uint8 TEXT_COLOR = 31;
|
||||
constexpr Uint8 COPYRIGHT_COLOR = 246; // (218,218,255) off-white amb un mínim de fred.
|
||||
// Color del text de "© 2026 JailDesigner": off-white càlid (índex
|
||||
// 183 = 255,218,170, peach/cream) — ~90% blanc amb tint càlid.
|
||||
constexpr Uint8 COPYRIGHT_COLOR = 183;
|
||||
// Color de l'outline del prompt "PRESS START" (no del copyright,
|
||||
// tot i compartir-se a versions antigues). Marró fosc càlid
|
||||
// (índex 19 = 109,72,0) coherent amb la paleta del logo.
|
||||
constexpr Uint8 PRESS_START_OUTLINE_COLOR = 19;
|
||||
// Posicions Y dels tres elements verticals de la TITLE, en
|
||||
// percentatge sobre `GameCanvas::HEIGHT`. El logo s'ancora pel
|
||||
// seu top (la imatge cau cap avall des d'aquest Y); el prompt
|
||||
// i el copyright es centren verticalment sobre la línia.
|
||||
constexpr int LOGO_Y_PERCENT = 15;
|
||||
constexpr int PROMPT_Y_PERCENT = 68;
|
||||
constexpr int COPYRIGHT_Y_PERCENT = 92;
|
||||
// Separació vertical entre el minilogo i el text del © al peu.
|
||||
constexpr int MINI_LOGO_GAP_PX = 2;
|
||||
constexpr int BLINK_VISIBLE_MS = 800;
|
||||
constexpr int BLINK_HIDDEN_MS = 200;
|
||||
|
||||
|
||||
Reference in new issue
Block a user