Pos ja compila pero no es veu una puta merda ...

This commit is contained in:
2024-10-10 08:06:36 +02:00
parent 3fa5b227ae
commit 6fe294c59d
2 changed files with 18 additions and 20 deletions

View File

@@ -1,12 +1,12 @@
#include "text.h"
#include <fstream> // for char_traits, basic_ostream, basic_ifstream, ope...
#include <iostream> // for cout
#include "sprite.h" // for Sprite
#include "texture.h" // for Texture
#include "utils.h" // for color_t
#include <fstream> // for char_traits, basic_ostream, basic_ifstream, ope...
#include <iostream> // for cout
#include "sprite.h" // for Sprite
#include "texture.h" // for Texture
#include "utils.h" // for color_t
// Llena una estructuta textFile_t desde un fichero
textFile_t LoadTextFile(std::string file, bool verbose)
textFile_t LoadTextFile(std::string file)
{
textFile_t tf;
@@ -51,21 +51,19 @@ textFile_t LoadTextFile(std::string file, bool verbose)
line_read++;
};
// Cierra el fichero
if (verbose)
{
std::cout << "Text loaded: " << filename.c_str() << std::endl;
}
// Cierra el fichero
#ifdef VERBOSE
std::cout << "Text loaded: " << filename.c_str() << std::endl;
#endif
rfile.close();
}
// El fichero no se puede abrir
else
{
if (verbose)
{
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
}
#ifdef VERBOSE
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
#endif
}
// Establece las coordenadas para cada caracter ascii de la cadena y su ancho
@@ -103,7 +101,7 @@ Text::Text(std::string bitmapFile, std::string textFile, SDL_Renderer *renderer)
}
// Constructor
Text::Text(std::string textFile, Texture *texture)
Text::Text(std::string textFile, std::shared_ptr<Texture> texture)
{
// Carga los offsets desde el fichero
textFile_t tf = LoadTextFile(textFile);
@@ -126,7 +124,7 @@ Text::Text(std::string textFile, Texture *texture)
}
// Constructor
Text::Text(textFile_t *textFile, Texture *texture)
Text::Text(textFile_t *textFile, std::shared_ptr<Texture> texture)
{
// Inicializa variables desde la estructura
boxHeight = textFile->boxHeight;

View File

@@ -26,7 +26,7 @@ struct textFile_t
};
// Llena una estructuta textFile_t desde un fichero
textFile_t LoadTextFile(std::string file, bool verbose = false);
textFile_t LoadTextFile(std::string file);
// Clase texto. Pinta texto en pantalla a partir de un bitmap
class Text
@@ -45,8 +45,8 @@ private:
public:
// Constructor
Text(std::string bitmapFile, std::string textFile, SDL_Renderer *renderer);
Text(std::string textFile, Texture *texture);
Text(textFile_t *textFile, Texture *texture);
Text(std::string textFile, std::shared_ptr<Texture> texture);
Text(textFile_t *textFile, std::shared_ptr<Texture> texture);
// Destructor
~Text() = default;