migrant a SDL3
This commit is contained in:
@@ -57,7 +57,11 @@ Scoreboard::Scoreboard()
|
||||
|
||||
// Recalcula las anclas de los elementos
|
||||
recalculateAnchors();
|
||||
power_meter_sprite_->setPosition({slot4_2_.x - 20, slot4_2_.y, 40, 7});
|
||||
power_meter_sprite_->setPosition(SDL_FRect{
|
||||
static_cast<float>(slot4_2_.x - 20),
|
||||
static_cast<float>(slot4_2_.y),
|
||||
40,
|
||||
7});
|
||||
|
||||
// Crea la textura de fondo
|
||||
background_ = nullptr;
|
||||
@@ -259,7 +263,7 @@ void Scoreboard::fillPanelTextures()
|
||||
// ENTER NAME
|
||||
{
|
||||
text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText(106));
|
||||
SDL_FRect rect = {enter_name_pos_.x, enter_name_pos_.y, 5, 7};
|
||||
SDL_FRect rect = {enter_name_pos_.x, enter_name_pos_.y, 5.0f, 7.0f};
|
||||
|
||||
// Recorre todos los slots de letras del nombre
|
||||
for (size_t j = 0; j < MAX_NAME_LENGHT; ++j)
|
||||
@@ -273,7 +277,7 @@ void Scoreboard::fillPanelTextures()
|
||||
if (j >= selector_pos_[i])
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer_, color.r, color.g, color.b, 255);
|
||||
SDL_RenderDrawLine(renderer_, rect.x, rect.y + rect.h, rect.x + rect.w, rect.y + rect.h);
|
||||
SDL_RenderLine(renderer_, rect.x, rect.y + rect.h, rect.x + rect.w, rect.y + rect.h);
|
||||
}
|
||||
|
||||
// Dibuja la letra
|
||||
@@ -364,28 +368,28 @@ void Scoreboard::recalculateAnchors()
|
||||
}
|
||||
|
||||
// Constantes para definir las zonas del panel_: 4 filas y 1 columna
|
||||
const int row_size = rect_.h / 4;
|
||||
const int text_height = 7;
|
||||
const int ROW_SIZE = rect_.h / 4;
|
||||
const int TEXT_HEIGHT = 7;
|
||||
|
||||
// Filas
|
||||
const int row1 = (row_size * 0) + (text_height / 2);
|
||||
const int row2 = (row_size * 1) + (text_height / 2) - 1;
|
||||
const int row3 = (row_size * 2) + (text_height / 2) - 2;
|
||||
const int row4 = (row_size * 3) + (text_height / 2) - 3;
|
||||
const float ROW1 = (ROW_SIZE * 0) + (TEXT_HEIGHT / 2);
|
||||
const float ROW2 = (ROW_SIZE * 1) + (TEXT_HEIGHT / 2) - 1;
|
||||
const float ROW3 = (ROW_SIZE * 2) + (TEXT_HEIGHT / 2) - 2;
|
||||
const float ROW4 = (ROW_SIZE * 3) + (TEXT_HEIGHT / 2) - 3;
|
||||
|
||||
// Columna
|
||||
const int col = panel_width / 2;
|
||||
const float COL = panel_width / 2;
|
||||
|
||||
// Slots de 4
|
||||
slot4_1_ = {col, row1};
|
||||
slot4_2_ = {col, row2};
|
||||
slot4_3_ = {col, row3};
|
||||
slot4_4_ = {col, row4};
|
||||
slot4_1_ = {COL, ROW1};
|
||||
slot4_2_ = {COL, ROW2};
|
||||
slot4_3_ = {COL, ROW3};
|
||||
slot4_4_ = {COL, ROW4};
|
||||
|
||||
// Primer cuadrado para poner el nombre de record
|
||||
const int enter_name_lenght = text_scoreboard_->lenght(std::string(MAX_NAME_LENGHT, 'A'));
|
||||
enter_name_pos_.x = col - (enter_name_lenght / 2);
|
||||
enter_name_pos_.y = row4;
|
||||
enter_name_pos_.x = COL - (enter_name_lenght / 2);
|
||||
enter_name_pos_.y = ROW4;
|
||||
|
||||
// Recoloca los sprites
|
||||
if (power_meter_sprite_)
|
||||
@@ -436,7 +440,7 @@ void Scoreboard::renderSeparator()
|
||||
{
|
||||
// Dibuja la linea que separa el marcador de la zona de juego
|
||||
SDL_SetRenderDrawColor(renderer_, separator_color.r, separator_color.g, separator_color.b, 255);
|
||||
SDL_RenderDrawLine(renderer_, 0, 0, rect_.w, 0);
|
||||
SDL_RenderLine(renderer_, 0, 0, rect_.w, 0);
|
||||
}
|
||||
|
||||
// Inicializa el vector de colores para el nombre
|
||||
|
||||
Reference in New Issue
Block a user