Posant make_uniques, s'ha quedat tot enmerdat per culpa d'un struct
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
#include <SDL2/SDL_render.h> // for SDL_Renderer
|
||||
#include <SDL2/SDL_stdinc.h> // for Uint8
|
||||
#include <string> // for string
|
||||
#include <memory>
|
||||
#include "utils.h"
|
||||
class Sprite; // lines 6-6
|
||||
class Texture; // lines 7-7
|
||||
#include "sprite.h"
|
||||
#include "texture.h"
|
||||
|
||||
#define TXT_COLOR 1
|
||||
#define TXT_SHADOW 2
|
||||
@@ -14,9 +15,7 @@ class Texture; // lines 7-7
|
||||
|
||||
struct offset_t
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int x, y, w;
|
||||
};
|
||||
|
||||
struct textFile_t
|
||||
@@ -34,8 +33,8 @@ class Text
|
||||
{
|
||||
private:
|
||||
// Objetos y punteros
|
||||
Sprite *sprite; // Objeto con los graficos para el texto
|
||||
Texture *texture; // Textura con los bitmaps del texto
|
||||
std::unique_ptr<Sprite> sprite; // Objeto con los graficos para el texto
|
||||
std::unique_ptr<Texture> texture; // Textura con los bitmaps del texto
|
||||
|
||||
// Variables
|
||||
int boxWidth; // Anchura de la caja de cada caracter en el png
|
||||
@@ -46,11 +45,11 @@ private:
|
||||
public:
|
||||
// Constructor
|
||||
Text(std::string bitmapFile, std::string textFile, SDL_Renderer *renderer);
|
||||
Text(std::string textFile, Texture *texture, SDL_Renderer *renderer);
|
||||
Text(textFile_t *textFile, Texture *texture, SDL_Renderer *renderer);
|
||||
Text(std::string textFile, Texture *texture);
|
||||
Text(textFile_t *textFile, Texture *texture);
|
||||
|
||||
// Destructor
|
||||
~Text();
|
||||
~Text() = default;
|
||||
|
||||
// Escribe el texto en pantalla
|
||||
void write(int x, int y, std::string text, int kerning = 1, int lenght = -1);
|
||||
@@ -71,7 +70,7 @@ public:
|
||||
int lenght(std::string text, int kerning = 1);
|
||||
|
||||
// Devuelve el valor de la variable
|
||||
int getCharacterSize();
|
||||
int getCharacterSize() const;
|
||||
|
||||
// Recarga la textura
|
||||
void reLoadTexture();
|
||||
|
||||
Reference in New Issue
Block a user