refactor(core/rendering): FONT_SIZE_PX compartit a hud_constants.hpp (HC-05)
Notifier::TEXT_SIZE i el TEXT_SIZE del namespace anònim de render_info declaraven, els dos, "8" com l'alçada del glif de 8bithud. Ara Rendering::Hud::FONT_SIZE_PX (a core/rendering/hud_constants.hpp) és l'única font de veritat; Notifier i RenderInfo l'inclouen. HC-04 (moure la resta de constants HUD a YAML) es marca DEFERRED al document: és una feature de runtime-config, no pura neteja. Build + smoke 5s xvfb OK (exit 124). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e1e8bc11a5
commit
f692739fed
4 files changed
+22
-6
No files matched your search
@@ -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-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-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-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-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 | PENDING | constante global font |
|
| 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-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-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ó |
|
| 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
|
- `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
|
- `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
|
- `2350f40` — HC-08: constants nominals a l'MSL de CRT-Pi amb explicació del 768/3
|
||||||
- `<pendent>` — 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
|
||||||
|
- `<pendent>` — HC-05: `Rendering::Hud::FONT_SIZE_PX` a `hud_constants.hpp` (consolida `TEXT_SIZE=8`)
|
||||||
@@ -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
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "core/rendering/hud_constants.hpp"
|
||||||
|
|
||||||
class Text;
|
class Text;
|
||||||
|
|
||||||
// Popup transitori a dalt i centrat. Entra lliscant des de dalt, es queda
|
// 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_H = 6;
|
||||||
static constexpr int PADDING_V = 3;
|
static constexpr int PADDING_V = 3;
|
||||||
static constexpr int TEXT_SIZE = 8;
|
static constexpr int HEIGHT = Rendering::Hud::FONT_SIZE_PX + (2 * PADDING_V);
|
||||||
static constexpr int HEIGHT = TEXT_SIZE + (2 * PADDING_V);
|
|
||||||
static constexpr int MARGIN_TOP = 2; // Separació amb la vora superior del canvas.
|
static constexpr int MARGIN_TOP = 2; // Separació amb la vora superior del canvas.
|
||||||
static constexpr float SLIDE_SPEED = 120.0F;
|
static constexpr float SLIDE_SPEED = 120.0F;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "core/rendering/hud_constants.hpp"
|
||||||
#include "core/rendering/screen.hpp"
|
#include "core/rendering/screen.hpp"
|
||||||
#include "core/rendering/text.hpp"
|
#include "core/rendering/text.hpp"
|
||||||
#include "core/resources/resource_cache.hpp"
|
#include "core/resources/resource_cache.hpp"
|
||||||
@@ -14,7 +15,7 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr int TEXT_SIZE = 8;
|
constexpr int TEXT_SIZE = Rendering::Hud::FONT_SIZE_PX;
|
||||||
constexpr int PADDING_V = (RenderInfo::HEIGHT - TEXT_SIZE) / 2;
|
constexpr int PADDING_V = (RenderInfo::HEIGHT - TEXT_SIZE) / 2;
|
||||||
|
|
||||||
// Llindar per saltar el dibuixat d'un segment quasi totalment transparent.
|
// Llindar per saltar el dibuixat d'un segment quasi totalment transparent.
|
||||||
|
|||||||
Reference in new issue
Block a user