This commit is contained in:
2025-10-27 18:35:53 +01:00
parent b1dca32a5b
commit 3179a08dac
63 changed files with 686 additions and 693 deletions

View File

@@ -24,7 +24,7 @@ struct TextFile {
};
// Llena una estructuta TextFile desde un fichero
std::shared_ptr<TextFile> loadTextFile(const std::string& file_path);
auto loadTextFile(const std::string& file_path) -> std::shared_ptr<TextFile>;
// Clase texto. Pinta texto en pantalla a partir de un bitmap
class Text {
@@ -40,8 +40,8 @@ class Text {
public:
// Constructor
Text(std::shared_ptr<Surface> surface, const std::string& text_file);
Text(std::shared_ptr<Surface> surface, std::shared_ptr<TextFile> text_file);
Text(const std::shared_ptr<Surface>& surface, const std::string& text_file);
Text(const std::shared_ptr<Surface>& surface, const std::shared_ptr<TextFile>& text_file);
// Destructor
~Text() = default;
@@ -50,10 +50,10 @@ class Text {
void write(int x, int y, const std::string& text, int kerning = 1, int lenght = -1);
// Escribe el texto en una textura
std::shared_ptr<Surface> writeToSurface(const std::string& text, int zoom = 1, int kerning = 1);
auto writeToSurface(const std::string& text, int zoom = 1, int kerning = 1) -> std::shared_ptr<Surface>;
// Escribe el texto con extras en una textura
std::shared_ptr<Surface> writeDXToSurface(Uint8 flags, const std::string& text, int kerning = 1, Uint8 text_color = Uint8(), Uint8 shadow_distance = 1, Uint8 shadow_color = Uint8(), int lenght = -1);
auto writeDXToSurface(Uint8 flags, const std::string& text, int kerning = 1, Uint8 text_color = Uint8(), Uint8 shadow_distance = 1, Uint8 shadow_color = Uint8(), int lenght = -1) -> std::shared_ptr<Surface>;
// Escribe el texto con colores
void writeColored(int x, int y, const std::string& text, Uint8 color, int kerning = 1, int lenght = -1);
@@ -68,10 +68,10 @@ class Text {
void writeDX(Uint8 flags, int x, int y, const std::string& text, int kerning = 1, Uint8 text_color = Uint8(), Uint8 shadow_distance = 1, Uint8 shadow_color = Uint8(), int lenght = -1);
// Obtiene la longitud en pixels de una cadena
int lenght(const std::string& text, int kerning = 1) const;
[[nodiscard]] auto lenght(const std::string& text, int kerning = 1) const -> int;
// Devuelve el valor de la variable
int getCharacterSize() const;
[[nodiscard]] auto getCharacterSize() const -> int;
// Establece si se usa un tamaño fijo de letra
void setFixedWidth(bool value);