Trabajando en el marcador

This commit is contained in:
2022-09-22 21:39:41 +02:00
parent 96c0ddf8ed
commit 1d9e5ff27d
5 changed files with 35 additions and 22 deletions

View File

@@ -43,6 +43,17 @@ void ScoreBoard::fillTexture()
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);
SDL_RenderClear(renderer);
// Pinta el degradado
const float num_lines = (SCOREBOARD_BOTTOM / 2) - SCOREBOARD_TOP;
for (int i = SCOREBOARD_TOP; i < SCOREBOARD_TOP + num_lines; i++)
{
float step = ((float)i / num_lines);
int alpha = 64 + ((0 - 64) * step);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, alpha);
SDL_RenderDrawLine(renderer, SCOREBOARD_LEFT, i, SCOREBOARD_RIGHT, i);
}
// Escribe los textos
text->writeDX(TXT_CENTER | TXT_SHADOW, PLAY_AREA_CENTER_FIRST_QUARTER_X, 8, "-LIVES-");
text->writeDX(TXT_CENTER | TXT_SHADOW, PLAY_AREA_CENTER_FIRST_QUARTER_X, 8 + text->getCharacterSize(), std::to_string(board->lives));