fix: corregit el tamany i la posició dels panells del marcador

This commit is contained in:
2024-08-13 17:26:52 +02:00
parent e51e3a5c43
commit 7ed0393a9b

View File

@@ -283,6 +283,7 @@ void Scoreboard::fillBackgroundTexture()
// Dibuja el fondo del marcador
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255);
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
SDL_RenderFillRect(renderer, nullptr);
// Copia las texturas de los paneles
@@ -298,12 +299,12 @@ void Scoreboard::fillBackgroundTexture()
// Recalcula las anclas de los elementos
void Scoreboard::recalculateAnchors()
{
const int panelWidth = rect.w / SCOREBOARD_MAX_PANELS;
const float panelWidth = (float)rect.w / (float)SCOREBOARD_MAX_PANELS;
for (int i = 0; i < SCOREBOARD_MAX_PANELS; ++i)
{
panel[i].pos.x = panelWidth * i;
panel[i].pos.x = roundf(panelWidth * i);
panel[i].pos.y = 0;
panel[i].pos.w = panelWidth;
panel[i].pos.w = roundf(panelWidth * (i + 1)) - panel[i].pos.x;
panel[i].pos.h = rect.h;
}