diff --git a/docs/audit-core-rendering.md b/docs/audit-core-rendering.md index 7ac97e1..1d06465 100644 --- a/docs/audit-core-rendering.md +++ b/docs/audit-core-rendering.md @@ -45,8 +45,8 @@ Los IDs se mantienen estables una vez asignados. Cada entrada apunta al(los) fic | HC-01 | `text.cpp:159` | `render(1, 15)` — `1` (tinta) y `15` (color por defecto) literales | Importante | DONE | `Text::INK_COLOR_INDEX` i `DEFAULT_TEXT_COLOR` | | HC-02 | `surface.cpp:29`, `screen.cpp:56,218,244` | `0xFF000000U`/`0xFF` alfa repetido | Menor | DONE | `Rendering::OPAQUE_ALPHA` a `canvas.hpp` | | HC-03 | `gif.cpp:71,95,…` | LZW `<11`/`<12`/`<2` y máscaras `0x80/0x70/0x07…` sin nombre | Menor | DONE | `LZW_MIN/MAX_CODE_LENGTH`, `SCREEN_GCT_FLAG`, `SCREEN_GCT_SIZE_MASK`, etc. | -| HC-04 | `notifier.hpp:41-46`, `render_info.hpp:38-40` | HUD constants hardcoded en clase, no en `defaults`/YAML | Importante | PENDING | `Defaults::Hud::…` o config.yaml | -| HC-05 | `render_info.cpp:19` + `notifier.hpp:43` | `TEXT_SIZE=8` duplicado | Menor | PENDING | constante global font | +| HC-04 | `notifier.hpp:41-46`, `render_info.hpp:38-40` | HUD constants hardcoded en clase, no en `defaults`/YAML | Importante | DEFERRED | Moure a YAML és una feature; de moment consolidades a `hud_constants.hpp` (via HC-05) | +| HC-05 | `render_info.cpp:19` + `notifier.hpp:43` | `TEXT_SIZE=8` duplicado | Menor | DONE | `Rendering::Hud::FONT_SIZE_PX` a `hud_constants.hpp` | | HC-06 | `render_info.cpp:64,138-139,193-195` | `segments_[3]` hardcode del segmento tiempo | Importante | DONE | constants `FPS/DRIVER/SHADER/TIME_SEGMENT` | | HC-07 | `render_info.cpp:207` | `% 3` hardcode nº de entradas enum | Menor | DONE | `Defaults::RENDER_INFO_POSITION_COUNT` | | HC-08 | `crtpi_pipeline.cpp:97` | `768.0f / h / 3.0f` magic en shader | Menor | DONE | `CRT_REFERENCE_HEIGHT` / `SUBPIXEL_DIV` a l'MSL amb explicació | @@ -135,4 +135,5 @@ Los IDs se mantienen estables una vez asignados. Cada entrada apunta al(los) fic - `8b413af` — HC-02: `Rendering::OPAQUE_ALPHA` a `canvas.hpp` reemplaça `0xFF000000U` repetit - `da66a7c` — INC-06 + INC-07: eliminats assignaments redundants `Sprite::pos_` a `MovingSprite`; designated initializer uniforme - `2350f40` — HC-08: constants nominals a l'MSL de CRT-Pi amb explicació del 768/3 -- `` — DUP-07: `CrtPiParams{}` com a única font de veritat dels defaults de CRT-Pi +- `e1e8bc1` — DUP-07: `CrtPiParams{}` com a única font de veritat dels defaults de CRT-Pi +- `` — HC-05: `Rendering::Hud::FONT_SIZE_PX` a `hud_constants.hpp` (consolida `TEXT_SIZE=8`) diff --git a/source/core/rendering/hud_constants.hpp b/source/core/rendering/hud_constants.hpp new file mode 100644 index 0000000..8fc4729 --- /dev/null +++ b/source/core/rendering/hud_constants.hpp @@ -0,0 +1,13 @@ +#pragma once + +// Constants compartides per als overlays HUD del projecte (Notifier, +// RenderInfo, ...). Són compile-time i depenen de la geometria del bitmap +// font 8bithud; en una fase futura es podran fer runtime llegint el .fnt, +// però de moment evitar duplicar-les ja és guany net. +namespace Rendering::Hud { + + // Alçada del glif de la font 8bithud en píxels del canvas. Coincideix + // amb box_height al .fnt i s'usa com a base de càlcul d'alçades HUD. + constexpr int FONT_SIZE_PX = 8; + +} // namespace Rendering::Hud diff --git a/source/core/rendering/notifier.hpp b/source/core/rendering/notifier.hpp index 0f4dc09..0960fde 100644 --- a/source/core/rendering/notifier.hpp +++ b/source/core/rendering/notifier.hpp @@ -6,6 +6,8 @@ #include #include +#include "core/rendering/hud_constants.hpp" + class Text; // Popup transitori a dalt i centrat. Entra lliscant des de dalt, es queda @@ -34,8 +36,7 @@ class Notifier { static constexpr int PADDING_H = 6; static constexpr int PADDING_V = 3; - static constexpr int TEXT_SIZE = 8; - static constexpr int HEIGHT = TEXT_SIZE + (2 * PADDING_V); + static constexpr int HEIGHT = Rendering::Hud::FONT_SIZE_PX + (2 * PADDING_V); static constexpr int MARGIN_TOP = 2; // Separació amb la vora superior del canvas. static constexpr float SLIDE_SPEED = 120.0F; diff --git a/source/core/rendering/render_info.cpp b/source/core/rendering/render_info.cpp index 738f39f..f460272 100644 --- a/source/core/rendering/render_info.cpp +++ b/source/core/rendering/render_info.cpp @@ -6,6 +6,7 @@ #include #include +#include "core/rendering/hud_constants.hpp" #include "core/rendering/screen.hpp" #include "core/rendering/text.hpp" #include "core/resources/resource_cache.hpp" @@ -14,7 +15,7 @@ namespace { - constexpr int TEXT_SIZE = 8; + constexpr int TEXT_SIZE = Rendering::Hud::FONT_SIZE_PX; constexpr int PADDING_V = (RenderInfo::HEIGHT - TEXT_SIZE) / 2; // Llindar per saltar el dibuixat d'un segment quasi totalment transparent.