working on class sections

This commit is contained in:
2021-04-17 23:46:14 +02:00
parent 2330820a15
commit e9ff516b1d
18 changed files with 329 additions and 6375 deletions

View File

@@ -1,9 +1,14 @@
#pragma once
#include "sprite.h"
#include "utils.h"
#ifndef TEXT_H
#define TEXT_H
#define TXT_COLOR 1
#define TXT_SHADOW 2
#define TXT_CENTER 4
// Clase texto. Pinta texto en pantalla a partir de un bitmap
class Text
{
@@ -23,30 +28,28 @@ private:
public:
// Constructor
Text();
Text(LTexture *texture, SDL_Renderer *renderer);
// Destructor
~Text();
// Inicializador
void init(LTexture *texture, SDL_Renderer *renderer, Uint8 type, Uint8 size);
void init(Uint8 type, Uint8 size);
// Escribe el texto en pantalla
void write(int x, int y, std::string text);
void write(int x, int y, std::string text, int kerning);
void write(int x, int y, std::string text, int kerning, Uint8 lenght);
void write(int x, int y, std::string text, int kerning = 0, Uint8 lenght = 0);
// Escribe el texto con colores
void writeColored(int x, int y, std::string text, Uint8 R, Uint8 G, Uint8 B);
void writeColored(int x, int y, std::string text, color_t color, int kerning = 0, Uint8 lenght = 0);
// Escribe el texto con sombra
void writeShadowed(int x, int y, std::string text, Uint8 R, Uint8 G, Uint8 B);
void writeShadowed(int x, int y, std::string text, color_t color, Uint8 shadowDistance = 1, int kerning = 0, Uint8 lenght = 0);
// Escribe el texto centrado en un punto x y con kerning
void writeCentered(int x, int y, std::string text, int kerning = 0);
void writeCentered(int x, int y, std::string text, int kerning = 0, Uint8 lenght = 0);
// Escribe el texto centrado en un punto x y con kerning
void writeCenteredAndColored(int x, int y, std::string text, int kerning = 0, Uint8 R = 255, Uint8 G = 255, Uint8 B = 255);
// Escribe texto con extras
void writeDX(Uint8 flags, int x, int y, std::string text, int kerning = 0, color_t textColor = {255, 255, 255}, Uint8 shadowDistance = 1, color_t shadowColor = {0, 0, 0}, Uint8 lenght = 0);
// Obtiene la longitud en pixels de una cadena
Uint16 lenght(std::string text, int kerning);