afegides shapes per a fonts

This commit is contained in:
2025-11-29 10:06:33 +01:00
parent 89302a2ee3
commit 983f42814f
69 changed files with 530 additions and 258 deletions

View File

@@ -0,0 +1,30 @@
// text_renderer.hpp - Renderitzador de text amb formes .shp
// © 2025 Port a C++20 amb SDL3
#pragma once
#include <string>
#include "../core/types.hpp"
// Forward declarations
struct SDL_Renderer;
namespace Graphics { class Shape; }
namespace Utils {
class TextRenderer {
public:
// Renderitza un string en la posició especificada
static void render(SDL_Renderer* renderer,
const std::string& text,
int x, int y,
int spacing = 22);
// Calcula el ancho total de un string
static int calculate_width(const std::string& text, int spacing = 22);
private:
// Mapea un caràcter a su nombre de archivo .shp
static std::string get_char_filename(char c);
};
} // namespace Utils