text: afegit TextStyle

This commit is contained in:
2025-07-21 14:23:07 +02:00
parent 734c348996
commit 087643c71b
2 changed files with 28 additions and 2 deletions

View File

@@ -7,10 +7,11 @@
#include <iostream> // Para cerr
#include <stdexcept> // Para runtime_error
#include "color.h" // Para Color, getFileName, printWithDots
#include "screen.h" // Para Screen
#include "sprite.h" // Para Sprite
#include "texture.h" // Para Texture
#include "utils.h" // Para Color, getFileName, printWithDots
#include "utils.h"
// Llena una estructuta TextFile desde un fichero
auto loadTextFile(const std::string &file_path) -> std::shared_ptr<TextFile> {
@@ -231,6 +232,12 @@ void Text::writeDX(Uint8 flags, int x, int y, const std::string &text, int kerni
}
}
// Escribe texto a partir de un TextStyle
void Text::writeDX(Uint8 flags, int x, int y, const std::string& text, const TextStyle& style, int length) {
writeDX(flags, x, y, text, style.kerning, style.text_color, style.shadow_distance, style.shadow_color);
}
// Obtiene la longitud en pixels de una cadena
auto Text::lenght(const std::string &text, int kerning) const -> int {
int shift = 0;