This commit is contained in:
2026-04-11 18:40:03 +02:00
parent bb38600aac
commit 72741896c1
27 changed files with 163 additions and 163 deletions

View File

@@ -14,7 +14,7 @@
#include "utils/utils.hpp" // Para getFileName, stringToColor, printWithDots
// Extrae el siguiente codepoint UTF-8 de la cadena, avanzando 'pos' al byte siguiente
auto Text::nextCodepoint(const std::string& s, size_t& pos) -> uint32_t { // NOLINT(readability-convert-member-functions-to-static)
auto Text::nextCodepoint(const std::string& s, size_t& pos) -> uint32_t {
auto c = static_cast<unsigned char>(s[pos]);
uint32_t cp = 0;
size_t extra = 0;
@@ -47,7 +47,7 @@ auto Text::nextCodepoint(const std::string& s, size_t& pos) -> uint32_t { // NO
}
// Convierte un codepoint Unicode a una cadena UTF-8
auto Text::codepointToUtf8(uint32_t cp) -> std::string { // NOLINT(readability-convert-member-functions-to-static)
auto Text::codepointToUtf8(uint32_t cp) -> std::string {
std::string result;
if (cp < 0x80) {
result += static_cast<char>(cp);
@@ -69,7 +69,7 @@ auto Text::codepointToUtf8(uint32_t cp) -> std::string { // NOLINT(readability-
// Carga un fichero de definición de fuente .fnt
// Formato: líneas "clave valor", comentarios con #, gliphos como "codepoint ancho"
auto Text::loadTextFile(const std::string& file_path) -> std::shared_ptr<File> { // NOLINT(readability-convert-member-functions-to-static)
auto Text::loadTextFile(const std::string& file_path) -> std::shared_ptr<File> {
auto tf = std::make_shared<File>();
auto file_data = Resource::Helper::loadFile(file_path);
@@ -145,7 +145,7 @@ Text::Text(const std::shared_ptr<Surface>& surface, const std::shared_ptr<File>&
}
// Escribe texto en pantalla
void Text::write(int x, int y, const std::string& text, int kerning, int lenght) { // NOLINT(readability-convert-member-functions-to-static)
void Text::write(int x, int y, const std::string& text, int kerning, int lenght) {
int shift = 0;
int glyphs_done = 0;
size_t pos = 0;
@@ -195,7 +195,7 @@ auto Text::writeDXToSurface(Uint8 flags, const std::string& text, int kerning, U
}
// Escribe el texto con colores
void Text::writeColored(int x, int y, const std::string& text, Uint8 color, int kerning, int lenght) { // NOLINT(readability-convert-member-functions-to-static)
void Text::writeColored(int x, int y, const std::string& text, Uint8 color, int kerning, int lenght) {
int shift = 0;
int glyphs_done = 0;
size_t pos = 0;
@@ -217,7 +217,7 @@ void Text::writeColored(int x, int y, const std::string& text, Uint8 color, int
}
// Escribe texto monoespaciado con color (cada glifo centrado en una celda de ancho fijo)
void Text::writeColoredMono(int x, int y, const std::string& text, Uint8 color, int cell_w) { // NOLINT(readability-convert-member-functions-to-static)
void Text::writeColoredMono(int x, int y, const std::string& text, Uint8 color, int cell_w) {
int shift = 0;
size_t pos = 0;
@@ -260,7 +260,7 @@ void Text::writeCentered(int x, int y, const std::string& text, int kerning, int
}
// Escribe texto con extras
void Text::writeDX(Uint8 flags, int x, int y, const std::string& text, int kerning, Uint8 text_color, Uint8 shadow_distance, Uint8 shadow_color, int lenght) { // NOLINT(readability-convert-member-functions-to-static)
void Text::writeDX(Uint8 flags, int x, int y, const std::string& text, int kerning, Uint8 text_color, Uint8 shadow_distance, Uint8 shadow_color, int lenght) {
const auto CENTERED = ((flags & CENTER_FLAG) == CENTER_FLAG);
const auto SHADOWED = ((flags & SHADOW_FLAG) == SHADOW_FLAG);
const auto COLORED = ((flags & COLOR_FLAG) == COLOR_FLAG);
@@ -293,7 +293,7 @@ void Text::writeDX(Uint8 flags, int x, int y, const std::string& text, int kerni
}
// Obtiene la longitud en pixels de una cadena UTF-8
auto Text::length(const std::string& text, int kerning) const -> int { // NOLINT(readability-convert-member-functions-to-static)
auto Text::length(const std::string& text, int kerning) const -> int {
int shift = 0;
size_t pos = 0;
@@ -310,7 +310,7 @@ auto Text::length(const std::string& text, int kerning) const -> int { // NOLIN
}
// Devuelve el ancho en pixels de un glifo dado su codepoint Unicode
auto Text::glyphWidth(uint32_t codepoint, int kerning) const -> int { // NOLINT(readability-convert-member-functions-to-static)
auto Text::glyphWidth(uint32_t codepoint, int kerning) const -> int {
auto it = offset_.find(codepoint);
if (it == offset_.end()) { it = offset_.find('?'); }
if (it != offset_.end()) { return it->second.w + kerning; }