renomena tipus _t/_e a CamelCase (Circle, Color, Section, ...)

This commit is contained in:
2026-05-14 22:16:36 +02:00
parent 9a2da460cc
commit 0bc55f5732
37 changed files with 209 additions and 209 deletions
+12 -12
View File
@@ -15,23 +15,23 @@ constexpr int TXT_SHADOW = 2;
constexpr int TXT_CENTER = 4;
constexpr int TXT_STROKE = 8;
struct offset_t {
struct Offset {
int x;
int y;
int w;
};
struct textFile_t {
struct TextFile {
int boxWidth; // Anchura de la caja de cada caracter en el png
int boxHeight; // Altura de la caja de cada caracter en el png
offset_t offset[128]; // Vector con las posiciones y ancho de cada letra
Offset offset[128]; // Vector con las posiciones y ancho de cada letra
};
// Llena una estructuta textFile_t desde un fichero
auto LoadTextFile(const std::string &file, bool verbose = false) -> textFile_t;
// Llena una estructuta TextFile desde un fichero
auto LoadTextFile(const std::string &file, bool verbose = false) -> TextFile;
// Llena una estructura textFile_t desde bytes en memoria
auto LoadTextFileFromMemory(const std::vector<uint8_t> &bytes, bool verbose = false) -> textFile_t;
// Llena una estructura TextFile desde bytes en memoria
auto LoadTextFileFromMemory(const std::vector<uint8_t> &bytes, bool verbose = false) -> TextFile;
// Clase texto. Pinta texto en pantalla a partir de un bitmap
class Text {
@@ -44,13 +44,13 @@ class Text {
int boxWidth; // Anchura de la caja de cada caracter en el png
int boxHeight; // Altura de la caja de cada caracter en el png
bool fixedWidth; // Indica si el texto se ha de escribir con longitud fija en todas las letras
offset_t offset[128]; // Vector con las posiciones y ancho de cada letra
Offset offset[128]; // Vector con las posiciones y ancho de cada letra
public:
// Constructor
Text(const std::string &bitmapFile, const std::string &textFile, SDL_Renderer *renderer);
Text(const std::string &textFile, Texture *texture, SDL_Renderer *renderer);
Text(textFile_t *textFile, Texture *texture, SDL_Renderer *renderer);
Text(TextFile *textFile, Texture *texture, SDL_Renderer *renderer);
// Constructor desde bytes en memoria: comparte ownership del texture (no lo libera)
Text(const std::vector<uint8_t> &pngBytes, const std::vector<uint8_t> &txtBytes, SDL_Renderer *renderer);
@@ -66,16 +66,16 @@ class Text {
void write(int x, int y, const std::string &text, int kerning = 1, int lenght = -1);
// Escribe el texto con colores
void writeColored(int x, int y, const std::string &text, color_t color, int kerning = 1, int lenght = -1);
void writeColored(int x, int y, const std::string &text, Color color, int kerning = 1, int lenght = -1);
// Escribe el texto con sombra
void writeShadowed(int x, int y, const std::string &text, color_t color, Uint8 shadowDistance = 1, int kerning = 1, int lenght = -1);
void writeShadowed(int x, int y, const std::string &text, Color color, Uint8 shadowDistance = 1, int kerning = 1, int lenght = -1);
// Escribe el texto centrado en un punto x
void writeCentered(int x, int y, const std::string &text, int kerning = 1, int lenght = -1);
// Escribe texto con extras
void writeDX(Uint8 flags, int x, int y, const std::string &text, int kerning = 1, color_t textColor = color_t(255, 255, 255), Uint8 shadowDistance = 1, color_t shadowColor = color_t(0, 0, 0), int lenght = -1);
void writeDX(Uint8 flags, int x, int y, const std::string &text, int kerning = 1, Color textColor = Color(255, 255, 255), Uint8 shadowDistance = 1, Color shadowColor = Color(0, 0, 0), int lenght = -1);
// Obtiene la longitud en pixels de una cadena
auto lenght(const std::string &text, int kerning = 1) -> int;