La tabla de puntuacions ja mostra aquelles aconseguides amb 1CC

This commit is contained in:
2025-02-05 15:15:48 +01:00
parent 7e2021da70
commit 6f594b9a1f
8 changed files with 22 additions and 17 deletions

View File

@@ -266,9 +266,9 @@ void HiScoreTable::createSprites()
int backbuffer_height;
SDL_QueryTexture(backbuffer_, nullptr, nullptr, &backbuffer_width, &backbuffer_height);
// Hay 27 letras - 7 de puntos quedan 20 caracteres 20 - name_lenght 0 num_dots <-- Esto no se qué coño es
constexpr int entry_lenght = 22;
constexpr int max_names = 10;
constexpr int space_between_header = 32;
const int space_between_header = entry_text->getCharacterSize() * 4;
const int space_between_lines = entry_text->getCharacterSize() * 2;
const int size = space_between_header + space_between_lines * (max_names - 1) + entry_text->getCharacterSize();
const int first_line = (param.game.height - size) / 2;
@@ -279,21 +279,25 @@ void HiScoreTable::createSprites()
// Crea los sprites para las entradas en la tabla de puntuaciones
const int animation = rand() % 4;
const std::string sample_line(entry_lenght + 3, ' ');
auto sample_entry = std::make_unique<Sprite>(entry_text->writeDXToTexture(TEXT_SHADOW, sample_line, 1, orange_color, 1, shdw_txt_color));
const auto entry_width = sample_entry->getWidth();
for (int i = 0; i < max_names; ++i)
{
// const auto table_position = (i + 1 >= 10) ? format(i + 1) + ". " : " " + format(i + 1) + ". ";
const auto table_position = format(i + 1) + ". ";
const auto score = format(options.game.hi_score_table.at(i).score);
const auto num_dots = 22 - options.game.hi_score_table.at(i).name.size() - score.size();
const auto num_dots = entry_lenght - options.game.hi_score_table.at(i).name.size() - score.size();
const auto one_cc = options.game.hi_score_table.at(i).one_credit_complete ? " }" : "";
std::string dots;
for (int j = 0; j < (int)num_dots; ++j)
{
dots = dots + ".";
}
const auto line = table_position + options.game.hi_score_table.at(i).name + dots + score;
const auto line = table_position + options.game.hi_score_table.at(i).name + dots + score + one_cc;
entry_names_.emplace_back(std::make_shared<PathSprite>(entry_text->writeDXToTexture(TEXT_SHADOW, line, 1, orange_color, 1, shdw_txt_color)));
const int pos_x = (i < 9) ? (backbuffer_width - entry_names_.front()->getWidth()) / 2 : (backbuffer_width - entry_names_.front()->getWidth()) / 2 - entry_text->getCharacterSize();
const int default_pos_x = (backbuffer_width - entry_width) / 2;
const int pos_x = (i < 9) ? default_pos_x : default_pos_x - entry_text->getCharacterSize();
const int pos_y = (i * space_between_lines) + first_line + space_between_header;
constexpr int steps = 80;
switch (animation)