Segmentation fault

This commit is contained in:
2023-05-07 18:08:36 +02:00
parent 90ebea4807
commit c1f8e16963
17 changed files with 163 additions and 73 deletions

View File

@@ -79,6 +79,7 @@ textFile_t LoadTextFile(string file, bool verbose)
// Constructor
Text::Text(string textFile, string bitmapFile, SDL_Renderer *renderer)
{
//std::cout << "Construido Text" << std::endl;
// Carga los offsets desde el fichero
textFile_t tf = LoadTextFile(textFile);
@@ -104,6 +105,7 @@ Text::Text(string textFile, string bitmapFile, SDL_Renderer *renderer)
// Constructor
Text::Text(string textFile, Texture *texture, SDL_Renderer *renderer)
{
//std::cout << "Construido Text" << std::endl;
// Carga los offsets desde el fichero
textFile_t tf = LoadTextFile(textFile);
@@ -128,6 +130,7 @@ Text::Text(string textFile, Texture *texture, SDL_Renderer *renderer)
// Constructor
Text::Text(textFile_t *textFile, Texture *texture, SDL_Renderer *renderer)
{
//std::cout << "Construido Text" << std::endl;
// Inicializa variables desde la estructura
boxHeight = textFile->boxHeight;
boxWidth = textFile->boxWidth;
@@ -149,8 +152,13 @@ Text::Text(textFile_t *textFile, Texture *texture, SDL_Renderer *renderer)
// Destructor
Text::~Text()
{
delete sprite;
if (texture)
//std::cout << "Destruido Text" << std::endl;
if (sprite != nullptr)
{
delete sprite;
}
if (texture != nullptr)
{
delete texture;
}