fix: havia un punter no inicialitzava a nullptr i en macos no passava res, pero en linux i windows si
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "scoreboard.h"
|
||||
#include <math.h>
|
||||
|
||||
// Constructor
|
||||
Scoreboard::Scoreboard(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang, options_t *options)
|
||||
@@ -35,6 +36,8 @@ Scoreboard::Scoreboard(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lan
|
||||
powerMeterSprite = new Sprite(offsetPowerMeter.x - 20, offsetPowerMeter.y, 40, 7, gamePowerMeterTexture);
|
||||
textScoreBoard = new Text(asset->get("8bithud.png"), asset->get("8bithud.txt"), renderer);
|
||||
|
||||
background = nullptr;
|
||||
|
||||
// Crea la textura de fondo
|
||||
createBackgroundTexture();
|
||||
|
||||
@@ -51,7 +54,10 @@ Scoreboard::~Scoreboard()
|
||||
delete gamePowerMeterTexture;
|
||||
delete powerMeterSprite;
|
||||
delete textScoreBoard;
|
||||
SDL_DestroyTexture(background);
|
||||
if (background)
|
||||
{
|
||||
SDL_DestroyTexture(background);
|
||||
}
|
||||
for (auto texture : panelTexture)
|
||||
{
|
||||
if (texture)
|
||||
@@ -310,7 +316,7 @@ void Scoreboard::recalculateAnchors()
|
||||
// Constantes para definir las zonas del panel: 4 filas y 1 columna
|
||||
const int rowSize = rect.h / 4;
|
||||
const int textHeight = 7;
|
||||
|
||||
|
||||
// Filas
|
||||
const int row1 = (rowSize * 0) + (textHeight / 2);
|
||||
const int row2 = (rowSize * 1) + (textHeight / 2) - 1;
|
||||
@@ -367,7 +373,7 @@ void Scoreboard::createPanelTextures()
|
||||
// Elimina las texturas en caso de existir
|
||||
for (auto texture : panelTexture)
|
||||
{
|
||||
if (texture)
|
||||
if (texture != nullptr)
|
||||
{
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user