Solventat bug amb el punter a ScoreboardData

This commit is contained in:
2025-02-27 14:17:00 +01:00
parent c6474cb2da
commit 0cec9f8556
20 changed files with 246 additions and 223 deletions

View File

@@ -21,6 +21,10 @@ struct ScoreboardData
Color color; // Color para escribir el texto del marcador
Uint32 ini_clock; // Tiempo inicial para calcular el tiempo transcurrido
bool jail_is_open; // Indica si se puede entrar a la Jail
// Constructor
ScoreboardData()
: items(0), lives(3), rooms(0), music(true), color({0, 0, 0}), ini_clock(0), jail_is_open(false) {}
};
class Scoreboard
@@ -41,7 +45,7 @@ private:
std::shared_ptr<Text> text_; // Objeto para escribir texto
std::shared_ptr<AnimatedSprite> player_sprite_; // Sprite para mostrar las vidas en el marcador
std::shared_ptr<Texture> item_texture_; // Textura con los graficos para las vidas
std::shared_ptr<ScoreboardData> board_; // Contiene las variables a mostrar en el marcador
std::shared_ptr<ScoreboardData> data_; // Contiene las variables a mostrar en el marcador
// Variables
std::vector<Color> color_; // Vector con los colores del objeto
@@ -61,7 +65,7 @@ private:
public:
// Constructor
Scoreboard(ScoreboardData *board);
Scoreboard(std::shared_ptr<ScoreboardData> data);
// Destructor
~Scoreboard() = default;