Trabajando en el marcador
This commit is contained in:
@@ -3,11 +3,13 @@
|
||||
#include <sstream>
|
||||
|
||||
// Constructor
|
||||
ScoreBoard::ScoreBoard(SDL_Renderer *renderer, Asset *asset)
|
||||
ScoreBoard::ScoreBoard(SDL_Renderer *renderer, Asset *asset, int *lives, int *items)
|
||||
{
|
||||
// Obten punteros a objetos
|
||||
this->asset = asset;
|
||||
this->renderer = renderer;
|
||||
this->lives = lives;
|
||||
this->items = items;
|
||||
|
||||
// Reserva memoria para los objetos
|
||||
texture = new LTexture();
|
||||
@@ -96,7 +98,7 @@ void ScoreBoard::render()
|
||||
const int frame = desp % 4;
|
||||
sprite->setCurrentFrame(frame);
|
||||
|
||||
for (int i = 0; i < num_lives; i++)
|
||||
for (int i = 0; i < *lives; i++)
|
||||
{
|
||||
sprite->setPosX(8 + (16 * i) + desp);
|
||||
index = i % color.size();
|
||||
@@ -105,7 +107,8 @@ void ScoreBoard::render()
|
||||
}
|
||||
|
||||
// Escribe los textos
|
||||
const std::string text = "Items collected 008 Time 88875";
|
||||
// const std::string text = "Items collected 008 Time 88875";
|
||||
std::string text = "Items collected " + std::to_string(*items / 100) + std::to_string((*items % 100) / 10) + std::to_string(*items % 10) + " Time 88875";
|
||||
const color_t color = stringToColor("white");
|
||||
this->text->writeColored(BLOCK, 21 * BLOCK, text, color);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user