neteja clang-tidy: enums uint8_t, includes, naming i altres
This commit is contained in:
@@ -178,22 +178,17 @@ void HiScoreTable::updateFade(float delta_time) {
|
||||
|
||||
// Convierte un entero a un string con separadores de miles
|
||||
auto HiScoreTable::format(int number) -> std::string {
|
||||
const std::string SEPARATOR = ".";
|
||||
const std::string SCORE = std::to_string(number);
|
||||
const size_t SIZE = SCORE.size();
|
||||
|
||||
auto index = static_cast<int>(SCORE.size()) - 1;
|
||||
std::string result;
|
||||
auto i = 0;
|
||||
while (index >= 0) {
|
||||
result = SCORE.at(index) + result;
|
||||
index--;
|
||||
i++;
|
||||
if (i == 3) {
|
||||
i = 0;
|
||||
result = SEPARATOR + result;
|
||||
result.reserve(SIZE + (SIZE / 3));
|
||||
for (size_t i = 0; i < SIZE; ++i) {
|
||||
if (i > 0 && (SIZE - i) % 3 == 0) {
|
||||
result += '.';
|
||||
}
|
||||
result += SCORE[i];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -215,7 +210,7 @@ void HiScoreTable::createSprites() {
|
||||
const int FIRST_LINE = (param.game.height - SIZE) / 2;
|
||||
|
||||
// Crea el sprite para el texto de cabecera
|
||||
header_ = std::make_unique<Sprite>(header_text->writeDXToTexture(Text::COLOR, Lang::getText("[HIGHSCORE_TABLE] CAPTION"), -2, background_fade_color_.INVERSE().LIGHTEN(25)));
|
||||
header_ = std::make_unique<Sprite>(header_text->writeDXToTexture(Text::COLOR, Lang::getText("[HIGHSCORE_TABLE] CAPTION"), -2, background_fade_color_.inverse().lighten(25)));
|
||||
header_->setPosition(param.game.game_area.center_x - (header_->getWidth() / 2), FIRST_LINE);
|
||||
|
||||
// Crea los sprites para las entradas en la tabla de puntuaciones
|
||||
@@ -228,13 +223,14 @@ void HiScoreTable::createSprites() {
|
||||
const auto SCORE = format(Options::settings.hi_score_table.at(i).score);
|
||||
const auto NUM_DOTS = ENTRY_LENGTH - Options::settings.hi_score_table.at(i).name.size() - SCORE.size();
|
||||
const auto* const ONE_CC = Options::settings.hi_score_table.at(i).one_credit_complete ? " }" : "";
|
||||
std::string dots;
|
||||
for (int j = 0; std::cmp_less(j, NUM_DOTS); ++j) {
|
||||
dots = dots + ".";
|
||||
}
|
||||
const auto LINE = TABLE_POSITION + Options::settings.hi_score_table.at(i).name + dots + SCORE + ONE_CC;
|
||||
const std::string DOTS(NUM_DOTS, '.');
|
||||
std::string line = TABLE_POSITION;
|
||||
line += Options::settings.hi_score_table.at(i).name;
|
||||
line += DOTS;
|
||||
line += SCORE;
|
||||
line += ONE_CC;
|
||||
|
||||
entry_names_.emplace_back(std::make_shared<PathSprite>(entry_text->writeDXToTexture(Text::SHADOW, LINE, 1, Colors::NO_COLOR_MOD, 1, Colors::SHADOW_TEXT)));
|
||||
entry_names_.emplace_back(std::make_shared<PathSprite>(entry_text->writeDXToTexture(Text::SHADOW, line, 1, Colors::NO_COLOR_MOD, 1, Colors::SHADOW_TEXT)));
|
||||
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;
|
||||
@@ -367,10 +363,10 @@ auto HiScoreTable::getEntryColor(int counter) -> Color {
|
||||
// Inicializa los colores de las entradas
|
||||
void HiScoreTable::iniEntryColors() {
|
||||
entry_colors_.clear();
|
||||
entry_colors_.emplace_back(background_fade_color_.INVERSE().LIGHTEN(75));
|
||||
entry_colors_.emplace_back(background_fade_color_.INVERSE().LIGHTEN(50));
|
||||
entry_colors_.emplace_back(background_fade_color_.INVERSE().LIGHTEN(25));
|
||||
entry_colors_.emplace_back(background_fade_color_.INVERSE());
|
||||
entry_colors_.emplace_back(background_fade_color_.inverse().lighten(75));
|
||||
entry_colors_.emplace_back(background_fade_color_.inverse().lighten(50));
|
||||
entry_colors_.emplace_back(background_fade_color_.inverse().lighten(25));
|
||||
entry_colors_.emplace_back(background_fade_color_.inverse());
|
||||
}
|
||||
|
||||
// Hace brillar los nombres de la tabla de records
|
||||
@@ -387,7 +383,7 @@ void HiScoreTable::glowEntryNames() {
|
||||
// Gestiona el contador
|
||||
void HiScoreTable::updateCounter() {
|
||||
if (elapsed_time_ >= BACKGROUND_CHANGE_S && !hiscore_flags_.background_changed) {
|
||||
background_->setColor(background_fade_color_.DARKEN());
|
||||
background_->setColor(background_fade_color_.darken());
|
||||
background_->setAlpha(96);
|
||||
hiscore_flags_.background_changed = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user