Pos ja compila pero no es veu una puta merda ...
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include <fstream> // for char_traits, basic_ostream, basic_ifstream, ope...
|
#include <fstream> // for char_traits, basic_ostream, basic_ifstream, ope...
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
#include "sprite.h" // for Sprite
|
#include "sprite.h" // for Sprite
|
||||||
#include "texture.h" // for Texture
|
#include "texture.h" // for Texture
|
||||||
#include "utils.h" // for color_t
|
#include "utils.h" // for color_t
|
||||||
|
|
||||||
// Llena una estructuta textFile_t desde un fichero
|
// 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;
|
textFile_t tf;
|
||||||
|
|
||||||
@@ -51,21 +51,19 @@ textFile_t LoadTextFile(std::string file, bool verbose)
|
|||||||
line_read++;
|
line_read++;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
if (verbose)
|
#ifdef VERBOSE
|
||||||
{
|
std::cout << "Text loaded: " << filename.c_str() << std::endl;
|
||||||
std::cout << "Text loaded: " << filename.c_str() << std::endl;
|
#endif
|
||||||
}
|
|
||||||
rfile.close();
|
rfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (verbose)
|
#ifdef VERBOSE
|
||||||
{
|
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
|
||||||
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
|
// 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
|
// Constructor
|
||||||
Text::Text(std::string textFile, Texture *texture)
|
Text::Text(std::string textFile, std::shared_ptr<Texture> texture)
|
||||||
{
|
{
|
||||||
// Carga los offsets desde el fichero
|
// Carga los offsets desde el fichero
|
||||||
textFile_t tf = LoadTextFile(textFile);
|
textFile_t tf = LoadTextFile(textFile);
|
||||||
@@ -126,7 +124,7 @@ Text::Text(std::string textFile, Texture *texture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Text::Text(textFile_t *textFile, Texture *texture)
|
Text::Text(textFile_t *textFile, std::shared_ptr<Texture> texture)
|
||||||
{
|
{
|
||||||
// Inicializa variables desde la estructura
|
// Inicializa variables desde la estructura
|
||||||
boxHeight = textFile->boxHeight;
|
boxHeight = textFile->boxHeight;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ struct textFile_t
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Llena una estructuta textFile_t desde un fichero
|
// 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
|
// Clase texto. Pinta texto en pantalla a partir de un bitmap
|
||||||
class Text
|
class Text
|
||||||
@@ -45,8 +45,8 @@ private:
|
|||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Text(std::string bitmapFile, std::string textFile, SDL_Renderer *renderer);
|
Text(std::string bitmapFile, std::string textFile, SDL_Renderer *renderer);
|
||||||
Text(std::string textFile, Texture *texture);
|
Text(std::string textFile, std::shared_ptr<Texture> texture);
|
||||||
Text(textFile_t *textFile, Texture *texture);
|
Text(textFile_t *textFile, std::shared_ptr<Texture> texture);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Text() = default;
|
~Text() = default;
|
||||||
|
|||||||
Reference in New Issue
Block a user