fix: corregit el tamany i la posició dels panells del marcador
This commit is contained in:
@@ -283,6 +283,7 @@ void Scoreboard::fillBackgroundTexture()
|
|||||||
|
|
||||||
// Dibuja el fondo del marcador
|
// Dibuja el fondo del marcador
|
||||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255);
|
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255);
|
||||||
|
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
|
||||||
SDL_RenderFillRect(renderer, nullptr);
|
SDL_RenderFillRect(renderer, nullptr);
|
||||||
|
|
||||||
// Copia las texturas de los paneles
|
// Copia las texturas de los paneles
|
||||||
@@ -298,12 +299,12 @@ void Scoreboard::fillBackgroundTexture()
|
|||||||
// Recalcula las anclas de los elementos
|
// Recalcula las anclas de los elementos
|
||||||
void Scoreboard::recalculateAnchors()
|
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)
|
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.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;
|
panel[i].pos.h = rect.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user