From 6fe294c59dbe619cdb04421f8313be7ec22db73d Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 10 Oct 2024 08:06:36 +0200 Subject: [PATCH] Pos ja compila pero no es veu una puta merda ... --- source/text.cpp | 32 +++++++++++++++----------------- source/text.h | 6 +++--- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/source/text.cpp b/source/text.cpp index 951e718..8518b80 100644 --- a/source/text.cpp +++ b/source/text.cpp @@ -1,12 +1,12 @@ #include "text.h" -#include // for char_traits, basic_ostream, basic_ifstream, ope... -#include // for cout -#include "sprite.h" // for Sprite -#include "texture.h" // for Texture -#include "utils.h" // for color_t +#include // for char_traits, basic_ostream, basic_ifstream, ope... +#include // 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) { // 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) { // Inicializa variables desde la estructura boxHeight = textFile->boxHeight; diff --git a/source/text.h b/source/text.h index 8dfd949..46fc58d 100644 --- a/source/text.h +++ b/source/text.h @@ -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); + Text(textFile_t *textFile, std::shared_ptr texture); // Destructor ~Text() = default;