Cambiada la disposición del marcador

This commit is contained in:
2022-09-11 22:15:31 +02:00
parent 1a78020ddd
commit f9eb36f529
3 changed files with 13 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
name=the edge name=the edge
bgColor=bright_black bgColor=red
border=black border=black
tileset=standard.png tileset=standard.png
roomUp=0 roomUp=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -77,13 +77,17 @@ ScoreBoard::~ScoreBoard()
// Pinta el objeto en pantalla // Pinta el objeto en pantalla
void ScoreBoard::render() void ScoreBoard::render()
{ {
// Anclas
const int line1 = 19 * BLOCK;
const int line2 = line1 + (2 * BLOCK);
// Dibuja el fondo del marcador // Dibuja el fondo del marcador
const SDL_Rect rect = {0, 18 * BLOCK, PLAY_AREA_WIDTH, GAMECANVAS_HEIGHT - PLAY_AREA_HEIGHT}; const SDL_Rect rect = {0, 18 * BLOCK, PLAY_AREA_WIDTH, GAMECANVAS_HEIGHT - PLAY_AREA_HEIGHT};
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderFillRect(renderer, &rect); SDL_RenderFillRect(renderer, &rect);
// Dibuja las vidas // Dibuja las vidas
sprite->setPosY(19 * BLOCK); sprite->setPosY(line2);
int index; int index;
const int desp = (counter / 40) % 8; const int desp = (counter / 40) % 8;
const int frame = desp % 4; const int frame = desp % 4;
@@ -103,19 +107,19 @@ void ScoreBoard::render()
const color_t c = stringToColor("bright_blue"); const color_t c = stringToColor("bright_blue");
SDL_Rect clip = {0, 8, 8, 8}; SDL_Rect clip = {0, 8, 8, 8};
itemTexture->setColor(c.r, c.g, c.b); itemTexture->setColor(c.r, c.g, c.b);
itemTexture->render(renderer, 20 * BLOCK, 20 * BLOCK, &clip); itemTexture->render(renderer, 20 * BLOCK, line2, &clip);
} }
// Escribe los textos // Escribe los textos
const std::string timeTxt = std::to_string((clock.minutes % 60) / 10) + std::to_string(clock.minutes % 10) + clock.separator + std::to_string((clock.seconds % 60) / 10) + std::to_string(clock.seconds % 10); const std::string timeTxt = std::to_string((clock.minutes % 60) / 10) + std::to_string(clock.minutes % 10) + clock.separator + std::to_string((clock.seconds % 60) / 10) + std::to_string(clock.seconds % 10);
const std::string itemsTxt = std::to_string(board->items / 100) + std::to_string((board->items % 100) / 10) + std::to_string(board->items % 10); const std::string itemsTxt = std::to_string(board->items / 100) + std::to_string((board->items % 100) / 10) + std::to_string(board->items % 10);
const std::string roomsTxt = std::to_string(board->rooms / 100) + std::to_string((board->rooms % 100) / 10) + std::to_string(board->rooms % 10); const std::string roomsTxt = std::to_string(board->rooms / 100) + std::to_string((board->rooms % 100) / 10) + std::to_string(board->rooms % 10);
this->text->writeColored(22 * BLOCK, 20 * BLOCK, "Rooms", stringToColor("yellow")); this->text->writeColored(BLOCK, line1, "Items collected ", stringToColor("yellow"));
this->text->writeColored(28 * BLOCK, 20 * BLOCK, roomsTxt, stringToColor("bright_blue")); this->text->writeColored(17 * BLOCK, line1, itemsTxt, stringToColor("bright_blue"));
this->text->writeColored(BLOCK, 22 * BLOCK, "Items collected ", stringToColor("yellow")); this->text->writeColored(20 * BLOCK, line1, " Time ", stringToColor("yellow"));
this->text->writeColored(17 * BLOCK, 22 * BLOCK, itemsTxt, stringToColor("bright_blue")); this->text->writeColored(26 * BLOCK, line1, timeTxt, stringToColor("bright_blue"));
this->text->writeColored(20 * BLOCK, 22 * BLOCK, " Time ", stringToColor("yellow")); this->text->writeColored(22 * BLOCK, line2, "Rooms", stringToColor("yellow"));
this->text->writeColored(26 * BLOCK, 22 * BLOCK, timeTxt, stringToColor("bright_blue")); this->text->writeColored(28 * BLOCK, line2, roomsTxt, stringToColor("bright_blue"));
} }
// Actualiza las variables del objeto // Actualiza las variables del objeto