Invertido el separador del reloj

This commit is contained in:
2022-09-01 13:14:15 +02:00
parent 6a84d114e8
commit 4433cc6943
2 changed files with 8 additions and 2 deletions

View File

@@ -110,7 +110,12 @@ void ScoreBoard::render()
// Escribe los textos
const clock_t clock = getTime();
std::string itemsTxt = std::to_string(*items / 100) + std::to_string((*items % 100) / 10) + std::to_string(*items % 10);
std::string timeTxt = std::to_string((clock.minutes % 60) / 10) + std::to_string(clock.minutes % 10) + ":" + std::to_string((clock.seconds % 60) / 10) + std::to_string(clock.seconds % 10);
std::string separator = " ";
if (clock.separator)
{
separator = ":";
}
std::string timeTxt = std::to_string((clock.minutes % 60) / 10) + std::to_string(clock.minutes % 10) + separator + std::to_string((clock.seconds % 60) / 10) + std::to_string(clock.seconds % 10);
std::string text = "Items collected " + itemsTxt + " Time " + timeTxt;
const color_t color = stringToColor("white");
this->text->writeColored(BLOCK, 21 * BLOCK, text, color);
@@ -131,5 +136,6 @@ ScoreBoard::clock_t ScoreBoard::getTime()
time.hours = timeElapsed / 3600000;
time.minutes = timeElapsed / 60000;
time.seconds = timeElapsed / 1000;
time.separator = (timeElapsed % 1000 <= 500);
return time;
}

View File

@@ -20,6 +20,7 @@ private:
int hours;
int minutes;
int seconds;
bool separator;
};
LTexture *texture; // Textura con los graficos para las vidas
@@ -33,7 +34,6 @@ private:
int *lives; // Número ara mostrar en el marcador de vidas
int *items; // Número para mostrar en el marcador de items
Uint32 *clock; // Contiene el tiempo de inicio de la partida
clock_t time; // Contiene el tiempo de partida transcurrido
// Obtiene el tiempo transcurrido de partida
clock_t getTime();