feat(intro): colors del rètol independents + restitueix line_gap_px

Dues claus noves a data/ui.yaml > colors:
  room_text         (relleno, default 232)
  room_text_outline (contorn, default 255)
Abans el relleno reciclava notification_text (compartit amb les
notificacions del HUD) i el contorn estava hardcodejat a 255 dins
renderRoomText. Ara són canals separats: tocar el rètol no afecta
les notificacions i tot viu al YAML.

UiConfig guanya roomText() / roomTextOutline(); Defaults::UI hi posa
els fallbacks; renderRoomText els consumeix.

Drive-by: torna a posar la clau room_intro.line_gap_px: 8 al
data/scenes/game.yaml — s'havia perdut en una edició manual del
fitxer per afinar timings.
This commit is contained in:
JailDesigner committed 2026-04-26 17:02:26 +02:00
1 parent 00594d9eb2
commit 3b05704e97
6 files changed
+33 -6

No files matched your search

+4 -3
View File
@@ -7,9 +7,10 @@
room_intro:
fade_in_ms: 500 # negre opac → món visible
text_delay_ms: 500 # espera amb el món net abans de sortir el text
text_enter_ms: 500 # text esquerra → centre
text_hold_ms: 1000 # text quiet al centre
text_exit_ms: 500 # text centre → fora per l'esquerra
text_enter_ms: 400 # text esquerra → centre
text_hold_ms: 1500 # text quiet al centre
text_exit_ms: 400 # text centre → fora per l'esquerra
line_gap_px: 8 # px extra entre les dues línies (piràmide / sala)
room_outro:
text_enter_ms: 500
+6
View File
@@ -20,6 +20,12 @@ colors:
hud_label: 58
hud_value: 187
hud_flash: 237
# Rètol de transició de sala (ROOM_INTRO i ROOM_OUTRO). Independents
# de notification_* perquè la fase i les notificacions són dos canals
# visuals distints: ací pots canviar el color del rètol sense tocar
# els missatges del HUD.
room_text: 232
room_text_outline: 255
timings:
notification_ms: 4000
+4
View File
@@ -85,6 +85,8 @@ UiConfig::UiConfig()
hud_label_(Defaults::UI::HUD_LABEL),
hud_value_(Defaults::UI::HUD_VALUE),
hud_flash_(Defaults::UI::HUD_FLASH),
room_text_(Defaults::UI::ROOM_TEXT),
room_text_outline_(Defaults::UI::ROOM_TEXT_OUTLINE),
notification_ms_(Defaults::UI::NOTIFICATION_TIME_MS),
exit_ms_(Defaults::UI::EXIT_TIME_MS),
hud_entry_ms_(Defaults::UI::HUD_ENTRY_MS),
@@ -148,6 +150,8 @@ void UiConfig::load(const std::string& file_path) {
readColorIndex(c, "hud_label", hud_label_);
readColorIndex(c, "hud_value", hud_value_);
readColorIndex(c, "hud_flash", hud_flash_);
readColorIndex(c, "room_text", room_text_);
readColorIndex(c, "room_text_outline", room_text_outline_);
}
if (yaml.contains("timings")) {
+4
View File
@@ -48,6 +48,8 @@ class UiConfig {
[[nodiscard]] auto hudLabel() const -> Uint8 { return hud_label_; }
[[nodiscard]] auto hudValue() const -> Uint8 { return hud_value_; }
[[nodiscard]] auto hudFlash() const -> Uint8 { return hud_flash_; }
[[nodiscard]] auto roomText() const -> Uint8 { return room_text_; }
[[nodiscard]] auto roomTextOutline() const -> Uint8 { return room_text_outline_; }
// Signatura d'una funció d'easing: t ∈ [0, 1] → valor ∈ [0, 1].
// Permet triar corbes des de data/ui.yaml per nom (cadena) i guardar
@@ -106,6 +108,8 @@ class UiConfig {
Uint8 hud_label_;
Uint8 hud_value_;
Uint8 hud_flash_;
Uint8 room_text_;
Uint8 room_text_outline_;
int notification_ms_;
int exit_ms_;
+8 -3
View File
@@ -649,8 +649,13 @@ void GameScene::renderRoomText() {
if (!room_text_font_) { return; }
constexpr int KERNING = 0;
constexpr Uint8 OUTLINE_WHITE = 255;
constexpr Uint8 STROKE_DIST = 1;
// Colors del rètol via UiConfig — abans el contorn estava
// hardcodejat a 255. Ara `data/ui.yaml > colors.room_text` i
// `room_text_outline` controlen relleno i contorn sense afectar
// les notificacions del HUD.
const Uint8 FILL_COLOR = UiConfig::get().roomText();
const Uint8 OUTLINE_COLOR = UiConfig::get().roomTextOutline();
// Calcula la X animada d'una línia: entra des de fora de pantalla,
// s'atura al CENTER_X durant el hold i surt pel costat oposat.
@@ -686,9 +691,9 @@ void GameScene::renderRoomText() {
y,
text,
KERNING,
UiConfig::get().notificationText(),
FILL_COLOR,
STROKE_DIST,
OUTLINE_WHITE);
OUTLINE_COLOR);
};
if (state_ == RoomFsm::State::ROOM_INTRO && transition_.phase >= 2 && transition_.phase <= 4) {
+7
View File
@@ -191,6 +191,13 @@ namespace Defaults {
constexpr Uint8 HUD_VALUE = 187; // Valors (score, vides, tresors).
constexpr Uint8 HUD_FLASH = 237; // Color temporal del valor en flash.
// Rètol de transició de sala (ROOM_INTRO i ROOM_OUTRO).
// Independent dels colors de notificació perquè el rètol de
// fase és un canal visual diferent. `ROOM_TEXT_OUTLINE` és el
// contorn que abans estava hardcodejat al `renderRoomText`.
constexpr Uint8 ROOM_TEXT = 232;
constexpr Uint8 ROOM_TEXT_OUTLINE = 255;
// Timings d'animació del HUD. L'entrada són els tres blocs lliscant
// a la seua posició; flash i shake acompanyen un `player_hit`.
constexpr int HUD_ENTRY_MS = 400;