Pasaeta de include-what-you-use

This commit is contained in:
2024-10-13 21:58:36 +02:00
parent d0a6e4c572
commit 9825c7fb9b
28 changed files with 229 additions and 239 deletions

View File

@@ -2,11 +2,11 @@
#include <SDL2/SDL_render.h> // for SDL_Renderer
#include <SDL2/SDL_stdinc.h> // for Uint8
#include <memory> // for shared_ptr, unique_ptr
#include <string> // for string
#include <memory>
#include "utils.h"
#include "sprite.h"
#include "texture.h"
#include "sprite.h" // for Sprite
#include "utils.h" // for Color
class Texture;
constexpr int TEXT_COLOR = 1;
constexpr int TEXT_SHADOW = 2;
@@ -33,13 +33,13 @@ class Text
{
private:
// Objetos y punteros
std::unique_ptr<Sprite> sprite_; // Objeto con los graficos para el texto
std::unique_ptr<Sprite> sprite_; // Objeto con los graficos para el texto
std::shared_ptr<Texture> texture_; // Textura con los bitmaps del texto
// Variables
int box_width_; // Anchura de la caja de cada caracter en el png
int box_height_; // Altura de la caja de cada caracter en el png
bool fixed_width_; // Indica si el texto se ha de escribir con longitud fija en todas las letras
int box_width_; // Anchura de la caja de cada caracter en el png
int box_height_; // Altura de la caja de cada caracter en el png
bool fixed_width_; // Indica si el texto se ha de escribir con longitud fija en todas las letras
TextOffset offset_[128]; // Vector con las posiciones y ancho de cada letra
public:
@@ -64,7 +64,7 @@ public:
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 textColor = {255, 255, 255}, Uint8 shadow_distance = 1, Color shadow_color = {0, 0, 0}, int lenght = -1);
void writeDX(Uint8 flags, int x, int y, const std::string &text, int kerning = 1, Color textColor = Color(), Uint8 shadow_distance = 1, Color shadow_color = Color(), int lenght = -1);
// Obtiene la longitud en pixels de una cadena
int lenght(const std::string &text, int kerning = 1) const;