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
@@ -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 <string>
|
||||
|
||||
#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;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#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.
|
||||
|
||||
Reference in new issue
Block a user