From 6b30e4c9273a2e5ddd40b93dc14a5e270be63131 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 10 Jun 2025 14:10:00 +0200 Subject: [PATCH] fix: arreglades les cridades a lang::getText("[SCOREBOARD] X") --- source/game.cpp | 4 ++-- source/scoreboard.cpp | 49 +++++++++++++++++++------------------------ 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/source/game.cpp b/source/game.cpp index c915131..2a9733b 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -1727,12 +1727,12 @@ void Game::initPlayers(int player_id) const int y = param.game.play_area.rect.h - 30; players_.emplace_back(std::make_unique(1, param.game.play_area.first_quarter_x - 15, y, demo_.enabled, param.game.play_area.rect, player_textures_[0], player_animations_)); players_.back()->setScoreBoardPanel(SCOREBOARD_LEFT_PANEL); - players_.back()->setName(lang::getText("SCOREBOARD_1")); + players_.back()->setName(lang::getText("[SCOREBOARD] 1")); players_.back()->setController(getController(players_.back()->getId())); players_.emplace_back(std::make_unique(2, param.game.play_area.third_quarter_x - 15, y, demo_.enabled, param.game.play_area.rect, player_textures_[1], player_animations_)); players_.back()->setScoreBoardPanel(SCOREBOARD_RIGHT_PANEL); - players_.back()->setName(lang::getText("SCOREBOARD_2")); + players_.back()->setName(lang::getText("[SCOREBOARD] 2")); players_.back()->setController(getController(players_.back()->getId())); // Activa el jugador que coincide con el "player_id" diff --git a/source/scoreboard.cpp b/source/scoreboard.cpp index 7d21d0e..f627950 100644 --- a/source/scoreboard.cpp +++ b/source/scoreboard.cpp @@ -139,17 +139,10 @@ void Scoreboard::setPos(SDL_FRect rect) { rect_ = rect; - // Recalcula las anclas de los elementos - recalculateAnchors(); - - // Crea la textura de fondo - createBackgroundTexture(); - - // Crea las texturas de los paneles - createPanelTextures(); - - // Rellena la textura de fondo - fillBackgroundTexture(); + recalculateAnchors(); // Recalcula las anclas de los elementos + createBackgroundTexture(); // Crea la textura de fondo + createPanelTextures(); // Crea las texturas de los paneles + fillBackgroundTexture(); // Rellena la textura de fondo } // Rellena los diferentes paneles del marcador @@ -177,7 +170,7 @@ void Scoreboard::fillPanelTextures() text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i])); // MULT - text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText("SCOREBOARD_3")); + text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText("[SCOREBOARD] 3")); text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y, "x" + std::to_string(mult_[i]).substr(0, 3)); break; } @@ -185,13 +178,13 @@ void Scoreboard::fillPanelTextures() case ScoreboardMode::DEMO: { // DEMO MODE - text_scoreboard_->writeCentered(slot4_1_.x, slot4_1_.y + 4, lang::getText("SCOREBOARD_6")); + text_scoreboard_->writeCentered(slot4_1_.x, slot4_1_.y + 4, lang::getText("[SCOREBOARD] 6")); // PRESS START TO PLAY if (time_counter_ % 10 < 8) { - text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("SCOREBOARD_8")); - text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y - 2, lang::getText("SCOREBOARD_9")); + text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("[SCOREBOARD] 8")); + text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y - 2, lang::getText("[SCOREBOARD] 9")); } break; } @@ -199,13 +192,13 @@ void Scoreboard::fillPanelTextures() case ScoreboardMode::WAITING: { // GAME OVER - text_scoreboard_->writeCentered(slot4_1_.x, slot4_1_.y + 4, lang::getText("SCOREBOARD_7")); + text_scoreboard_->writeCentered(slot4_1_.x, slot4_1_.y + 4, lang::getText("[SCOREBOARD] 7")); // PRESS START TO PLAY if (time_counter_ % 10 < 8) { - text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("SCOREBOARD_8")); - text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y - 2, lang::getText("SCOREBOARD_9")); + text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("[SCOREBOARD] 8")); + text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y - 2, lang::getText("[SCOREBOARD] 9")); } break; } @@ -213,13 +206,13 @@ void Scoreboard::fillPanelTextures() case ScoreboardMode::GAME_OVER: { // GAME OVER - text_scoreboard_->writeCentered(slot4_1_.x, slot4_1_.y + 4, lang::getText("SCOREBOARD_7")); + text_scoreboard_->writeCentered(slot4_1_.x, slot4_1_.y + 4, lang::getText("[SCOREBOARD] 7")); // PLEASE WAIT if (time_counter_ % 10 < 8) { - text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("SCOREBOARD_12")); - text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y - 2, lang::getText("SCOREBOARD_13")); + text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("[SCOREBOARD] 12")); + text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y - 2, lang::getText("[SCOREBOARD] 13")); } break; } @@ -227,7 +220,7 @@ void Scoreboard::fillPanelTextures() case ScoreboardMode::STAGE_INFO: { // STAGE - text_scoreboard_->writeCentered(slot4_1_.x, slot4_1_.y, lang::getText("SCOREBOARD_5") + std::to_string(stage_)); + text_scoreboard_->writeCentered(slot4_1_.x, slot4_1_.y, lang::getText("[SCOREBOARD] 5") + std::to_string(stage_)); // POWERMETER power_meter_sprite_->setSpriteClip(0, 0, 40, 7); @@ -236,7 +229,7 @@ void Scoreboard::fillPanelTextures() power_meter_sprite_->render(); // HI-SCORE - text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText("SCOREBOARD_4")); + text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText("[SCOREBOARD] 4")); const std::string name = hi_score_name_ == "" ? "" : hi_score_name_ + " - "; text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y, name + updateScoreText(hi_score_)); break; @@ -249,7 +242,7 @@ void Scoreboard::fillPanelTextures() text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i])); // CONTINUE - text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText("SCOREBOARD_10")); + text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText("[SCOREBOARD] 10")); text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y, std::to_string(continue_counter_[i])); break; } @@ -262,7 +255,7 @@ void Scoreboard::fillPanelTextures() // ENTER NAME { - text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText("SCOREBOARD_11")); + text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText("[SCOREBOARD] 11")); SDL_FRect rect = {enter_name_pos_.x, enter_name_pos_.y, 5.0f, 7.0f}; // Recorre todos los slots de letras del nombre @@ -298,7 +291,7 @@ void Scoreboard::fillPanelTextures() text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i])); // NAME - text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText("SCOREBOARD_11")); + text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText("[SCOREBOARD] 11")); /* TEXTO CENTRADO */ // text_scoreboard_->writeDX(TEXT_CENTER | TEXT_COLOR, slot4_4_.x, slot4_4_.y, record_name_[i], 1, getColorLikeKnightRider(name_colors_, loop_counter_ / 5)); @@ -309,12 +302,12 @@ void Scoreboard::fillPanelTextures() case ScoreboardMode::GAME_COMPLETED: { // GAME OVER - text_scoreboard_->writeCentered(slot4_1_.x, slot4_1_.y + 4, lang::getText("SCOREBOARD_7")); + text_scoreboard_->writeCentered(slot4_1_.x, slot4_1_.y + 4, lang::getText("[SCOREBOARD] 7")); // SCORE if (time_counter_ % 10 < 8) { - text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("SCOREBOARD_14")); + text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("[SCOREBOARD] 14")); text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y - 2, updateScoreText(score_[i])); } }