ServiceMenu: utilitza "lang" per als textos

This commit is contained in:
2025-06-07 12:37:33 +02:00
parent 1bd488e3e3
commit 06fc8c8579
15 changed files with 144 additions and 83 deletions

View File

@@ -53,7 +53,7 @@
"[NOTIFICATIONS] 06": "activat", "[NOTIFICATIONS] 06": "activat",
"[NOTIFICATIONS] 07": "desactivat", "[NOTIFICATIONS] 07": "desactivat",
"[NOTIFICATIONS] 08": "Dispar automatic", "[NOTIFICATIONS] 08": "Dispar automatic",
"[NOTIFICATIONS] 09": "Zoom de finestra", "[NOTIFICATIONS] 09": "Tamany de la finestra",
"[NOTIFICATIONS] 10": "Mode finestra", "[NOTIFICATIONS] 10": "Mode finestra",
"[NOTIFICATIONS] 11": "Mode pantalla completa", "[NOTIFICATIONS] 11": "Mode pantalla completa",
"[NOTIFICATIONS] 12": "Mode d'escalat sencer", "[NOTIFICATIONS] 12": "Mode d'escalat sencer",
@@ -61,6 +61,26 @@
"[NOTIFICATIONS] 14": "Sincronisme vertical", "[NOTIFICATIONS] 14": "Sincronisme vertical",
"[NOTIFICATIONS] 15": "Reiniciar", "[NOTIFICATIONS] 15": "Reiniciar",
"[SERVICE_MENU] TITLE": "Menu de servei",
"[SERVICE_MENU] RESET": "Reiniciar",
"[SERVICE_MENU] QUIT": "Eixir del joc",
"[SERVICE_MENU] SHUTDOWN": "Apagar el sistema",
"[SERVICE_MENU] FULLSCREEN": "Pantalla completa",
"[SERVICE_MENU] WINDOW_SIZE": "Tamany de la finestra",
"[SERVICE_MENU] SHADERS": "Filtre",
"[SERVICE_MENU] VSYNC": "Sincronisme vertical",
"[SERVICE_MENU] INTEGER_SCALE": "Escalat sencer",
"[SERVICE_MENU] MAIN_VOLUME": "Volumen general",
"[SERVICE_MENU] MUSIC_VOLUME": "Volumen de la musica",
"[SERVICE_MENU] SFX_VOLUME": "Volumen dels sons",
"[SERVICE_MENU] AUTOFIRE": "Dispar automatic",
"[SERVICE_MENU] VIDEO": "Video",
"[SERVICE_MENU] AUDIO": "Audio",
"[SERVICE_MENU] GAME": "Joc",
"[SERVICE_MENU] SYSTEM": "Sistema",
"[SERVICE_MENU] ON": "Activat",
"[SERVICE_MENU] OFF": "Desactivat",
"[SCOREBOARD] 1": "Jugador 1", "[SCOREBOARD] 1": "Jugador 1",
"[SCOREBOARD] 2": "Jugador 2", "[SCOREBOARD] 2": "Jugador 2",
"[SCOREBOARD] 3": "Multiplicador", "[SCOREBOARD] 3": "Multiplicador",

View File

@@ -61,6 +61,26 @@
"[NOTIFICATIONS] 14": "Vertical Sync", "[NOTIFICATIONS] 14": "Vertical Sync",
"[NOTIFICATIONS] 15": "Reset", "[NOTIFICATIONS] 15": "Reset",
"[SERVICE_MENU] TITLE": "Service Menu",
"[SERVICE_MENU] RESET": "Reset",
"[SERVICE_MENU] QUIT": "Quit Game",
"[SERVICE_MENU] SHUTDOWN": "Shutdown System",
"[SERVICE_MENU] FULLSCREEN": "Fullscreen",
"[SERVICE_MENU] WINDOW_SIZE": "Window Size",
"[SERVICE_MENU] SHADERS": "Shaders",
"[SERVICE_MENU] VSYNC": "V-Sync",
"[SERVICE_MENU] INTEGER_SCALE": "Integer Scale",
"[SERVICE_MENU] MAIN_VOLUME": "Main Volume",
"[SERVICE_MENU] MUSIC_VOLUME": "Music Volume",
"[SERVICE_MENU] SFX_VOLUME": "Sound Volume",
"[SERVICE_MENU] AUTOFIRE": "Autofire",
"[SERVICE_MENU] VIDEO": "Video",
"[SERVICE_MENU] AUDIO": "Audio",
"[SERVICE_MENU] GAME": "Game",
"[SERVICE_MENU] SYSTEM": "System",
"[SERVICE_MENU] ON": "On",
"[SERVICE_MENU] OFF": "Off",
"[SCOREBOARD] 1": "Player 1", "[SCOREBOARD] 1": "Player 1",
"[SCOREBOARD] 2": "Player 2", "[SCOREBOARD] 2": "Player 2",
"[SCOREBOARD] 3": "Multiplier", "[SCOREBOARD] 3": "Multiplier",

View File

@@ -61,6 +61,26 @@
"[NOTIFICATIONS] 14": "Sincronismo vertical", "[NOTIFICATIONS] 14": "Sincronismo vertical",
"[NOTIFICATIONS] 15": "Reiniciar", "[NOTIFICATIONS] 15": "Reiniciar",
"[SERVICE_MENU] TITLE": "Menu de servicio",
"[SERVICE_MENU] RESET": "Reiniciar",
"[SERVICE_MENU] QUIT": "Salir del juego",
"[SERVICE_MENU] SHUTDOWN": "Apagar el sistema",
"[SERVICE_MENU] FULLSCREEN": "Pantalla completa",
"[SERVICE_MENU] WINDOW_SIZE": "Zoom de ventana",
"[SERVICE_MENU] SHADERS": "Filtro",
"[SERVICE_MENU] VSYNC": "Sincronismo vertical",
"[SERVICE_MENU] INTEGER_SCALE": "Escalado entero",
"[SERVICE_MENU] MAIN_VOLUME": "Volumen general",
"[SERVICE_MENU] MUSIC_VOLUME": "Volumen de la musica",
"[SERVICE_MENU] SFX_VOLUME": "Volumen de los efectos",
"[SERVICE_MENU] AUTOFIRE": "Disparo automatico",
"[SERVICE_MENU] VIDEO": "Video",
"[SERVICE_MENU] AUDIO": "Audio",
"[SERVICE_MENU] GAME": "Juego",
"[SERVICE_MENU] SYSTEM": "Sistema",
"[SERVICE_MENU] ON": "Activado",
"[SERVICE_MENU] OFF": "Desactivado",
"[SCOREBOARD] 1": "Jugador 1", "[SCOREBOARD] 1": "Jugador 1",
"[SCOREBOARD] 2": "Jugador 2", "[SCOREBOARD] 2": "Jugador 2",
"[SCOREBOARD] 3": "Multiplicador", "[SCOREBOARD] 3": "Multiplicador",

View File

@@ -1645,8 +1645,8 @@ void Game::initDemo(int player_id)
Audio::get()->disableSound(); Audio::get()->disableSound();
// Configura los marcadores // Configura los marcadores
scoreboard_->setMode([SCOREBOARD] LEFT_PANEL, ScoreboardMode::DEMO); scoreboard_->setMode(SCOREBOARD_LEFT_PANEL, ScoreboardMode::DEMO);
scoreboard_->setMode([SCOREBOARD] RIGHT_PANEL, ScoreboardMode::DEMO); scoreboard_->setMode(SCOREBOARD_RIGHT_PANEL, ScoreboardMode::DEMO);
} }
// Modo grabar demo // Modo grabar demo
@@ -1672,7 +1672,7 @@ void Game::setTotalPower()
void Game::initScoreboard() void Game::initScoreboard()
{ {
scoreboard_->setPos({param.scoreboard.x, param.scoreboard.y, param.scoreboard.w, param.scoreboard.h}); scoreboard_->setPos({param.scoreboard.x, param.scoreboard.y, param.scoreboard.w, param.scoreboard.h});
scoreboard_->setMode([SCOREBOARD] CENTER_PANEL, ScoreboardMode::STAGE_INFO); scoreboard_->setMode(SCOREBOARD_CENTER_PANEL, ScoreboardMode::STAGE_INFO);
for (const auto &player : players_) for (const auto &player : players_)
{ {
scoreboard_->setName(player->getScoreBoardPanel(), player->getName()); scoreboard_->setName(player->getScoreBoardPanel(), player->getName());
@@ -1693,7 +1693,7 @@ void Game::initDifficultyVars()
{ {
balloon_manager_->setDefaultBalloonSpeed(BALLOON_SPEED[0]); balloon_manager_->setDefaultBalloonSpeed(BALLOON_SPEED[0]);
difficulty_score_multiplier_ = 0.5f; difficulty_score_multiplier_ = 0.5f;
scoreboard_->setColor([SCOREBOARD] EASY_COLOR); scoreboard_->setColor(SCOREBOARD_EASY_COLOR);
break; break;
} }
@@ -1701,7 +1701,7 @@ void Game::initDifficultyVars()
{ {
balloon_manager_->setDefaultBalloonSpeed(BALLOON_SPEED[0]); balloon_manager_->setDefaultBalloonSpeed(BALLOON_SPEED[0]);
difficulty_score_multiplier_ = 1.0f; difficulty_score_multiplier_ = 1.0f;
scoreboard_->setColor([SCOREBOARD] NORMAL_COLOR); scoreboard_->setColor(SCOREBOARD_NORMAL_COLOR);
break; break;
} }
@@ -1709,7 +1709,7 @@ void Game::initDifficultyVars()
{ {
balloon_manager_->setDefaultBalloonSpeed(BALLOON_SPEED[4]); balloon_manager_->setDefaultBalloonSpeed(BALLOON_SPEED[4]);
difficulty_score_multiplier_ = 1.5f; difficulty_score_multiplier_ = 1.5f;
scoreboard_->setColor([SCOREBOARD] HARD_COLOR); scoreboard_->setColor(SCOREBOARD_HARD_COLOR);
break; break;
} }
@@ -1726,13 +1726,13 @@ void Game::initPlayers(int player_id)
// Crea los dos jugadores // Crea los dos jugadores
const int y = param.game.play_area.rect.h - 30; const int y = param.game.play_area.rect.h - 30;
players_.emplace_back(std::make_unique<Player>(1, param.game.play_area.first_quarter_x - 15, y, demo_.enabled, param.game.play_area.rect, player_textures_[0], player_animations_)); players_.emplace_back(std::make_unique<Player>(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()->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_.back()->setController(getController(players_.back()->getId()));
players_.emplace_back(std::make_unique<Player>(2, param.game.play_area.third_quarter_x - 15, y, demo_.enabled, param.game.play_area.rect, player_textures_[1], player_animations_)); players_.emplace_back(std::make_unique<Player>(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()->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())); players_.back()->setController(getController(players_.back()->getId()));
// Activa el jugador que coincide con el "player_id" // Activa el jugador que coincide con el "player_id"

View File

@@ -155,7 +155,7 @@ namespace globalInputs
case section::Name::INSTRUCTIONS: case section::Name::INSTRUCTIONS:
{ {
section::name = section::Name::TITLE; section::name = section::Name::TITLE;
section::options = section::Options::[TITLE] PRESS_BUTTON_TO_PLAY; section::options = section::Options::TITLE_1;
section::attract_mode = section::AttractMode::TITLE_TO_DEMO; section::attract_mode = section::AttractMode::TITLE_TO_DEMO;
break; break;
} }

View File

@@ -369,6 +369,6 @@ void Instructions::updateBackbuffer()
if (all_lines_off_screen_) if (all_lines_off_screen_)
{ {
section::name = section::Name::TITLE; section::name = section::Name::TITLE;
section::options = section::Options::[TITLE] PRESS_BUTTON_TO_PLAY; section::options = section::Options::TITLE_1;
} }
} }

View File

@@ -515,7 +515,7 @@ void Intro::updatePostState()
{ {
Audio::get()->stopMusic(); Audio::get()->stopMusic();
section::name = section::Name::TITLE; section::name = section::Name::TITLE;
section::options = section::Options::[TITLE] PRESS_BUTTON_TO_PLAY; section::options = section::Options::TITLE_1;
} }
break; break;

View File

@@ -41,7 +41,7 @@ Scoreboard::Scoreboard()
text_scoreboard_(Resource::get()->getText("8bithud")) text_scoreboard_(Resource::get()->getText("8bithud"))
{ {
// Inicializa variables // Inicializa variables
for (int i = 0; i < [SCOREBOARD] MAX_PANELS; ++i) for (int i = 0; i < SCOREBOARD_MAX_PANELS; ++i)
{ {
name_[i].clear(); name_[i].clear();
record_name_[i].clear(); record_name_[i].clear();
@@ -51,9 +51,9 @@ Scoreboard::Scoreboard()
continue_counter_[i] = 0; continue_counter_[i] = 0;
} }
panel_[[SCOREBOARD] LEFT_PANEL].mode = ScoreboardMode::SCORE; panel_[SCOREBOARD_LEFT_PANEL].mode = ScoreboardMode::SCORE;
panel_[[SCOREBOARD] RIGHT_PANEL].mode = ScoreboardMode::SCORE; panel_[SCOREBOARD_RIGHT_PANEL].mode = ScoreboardMode::SCORE;
panel_[[SCOREBOARD] CENTER_PANEL].mode = ScoreboardMode::STAGE_INFO; panel_[SCOREBOARD_CENTER_PANEL].mode = ScoreboardMode::STAGE_INFO;
// Recalcula las anclas de los elementos // Recalcula las anclas de los elementos
recalculateAnchors(); recalculateAnchors();
@@ -159,7 +159,7 @@ void Scoreboard::fillPanelTextures()
auto temp = SDL_GetRenderTarget(renderer_); auto temp = SDL_GetRenderTarget(renderer_);
// Genera el contenido de cada panel_ // Genera el contenido de cada panel_
for (size_t i = 0; i < [SCOREBOARD] MAX_PANELS; ++i) for (size_t i = 0; i < SCOREBOARD_MAX_PANELS; ++i)
{ {
// Cambia el destino del renderizador // Cambia el destino del renderizador
SDL_SetRenderTarget(renderer_, panel_texture_[i]); SDL_SetRenderTarget(renderer_, panel_texture_[i]);
@@ -177,7 +177,7 @@ void Scoreboard::fillPanelTextures()
text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i])); text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i]));
// MULT // 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)); text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y, "x" + std::to_string(mult_[i]).substr(0, 3));
break; break;
} }
@@ -185,13 +185,13 @@ void Scoreboard::fillPanelTextures()
case ScoreboardMode::DEMO: case ScoreboardMode::DEMO:
{ {
// DEMO MODE // 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 // PRESS START TO PLAY
if (time_counter_ % 10 < 8) if (time_counter_ % 10 < 8)
{ {
text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("[SCOREBOARD] 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_4_.x, slot4_4_.y - 2, lang::getText("SCOREBOARD_9"));
} }
break; break;
} }
@@ -199,13 +199,13 @@ void Scoreboard::fillPanelTextures()
case ScoreboardMode::WAITING: case ScoreboardMode::WAITING:
{ {
// 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"));
// PRESS START TO PLAY // PRESS START TO PLAY
if (time_counter_ % 10 < 8) if (time_counter_ % 10 < 8)
{ {
text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("[SCOREBOARD] 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_4_.x, slot4_4_.y - 2, lang::getText("SCOREBOARD_9"));
} }
break; break;
} }
@@ -213,13 +213,13 @@ void Scoreboard::fillPanelTextures()
case ScoreboardMode::GAME_OVER: case ScoreboardMode::GAME_OVER:
{ {
// 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 // PLEASE WAIT
if (time_counter_ % 10 < 8) if (time_counter_ % 10 < 8)
{ {
text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y - 2, lang::getText("[SCOREBOARD] 12")); 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_4_.x, slot4_4_.y - 2, lang::getText("SCOREBOARD_13"));
} }
break; break;
} }
@@ -227,7 +227,7 @@ void Scoreboard::fillPanelTextures()
case ScoreboardMode::STAGE_INFO: case ScoreboardMode::STAGE_INFO:
{ {
// STAGE // 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 // POWERMETER
power_meter_sprite_->setSpriteClip(0, 0, 40, 7); power_meter_sprite_->setSpriteClip(0, 0, 40, 7);
@@ -236,7 +236,7 @@ void Scoreboard::fillPanelTextures()
power_meter_sprite_->render(); power_meter_sprite_->render();
// HI-SCORE // 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_ + " - "; const std::string name = hi_score_name_ == "" ? "" : hi_score_name_ + " - ";
text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y, name + updateScoreText(hi_score_)); text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y, name + updateScoreText(hi_score_));
break; break;
@@ -249,7 +249,7 @@ void Scoreboard::fillPanelTextures()
text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i])); text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i]));
// CONTINUE // 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])); text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y, std::to_string(continue_counter_[i]));
break; break;
} }
@@ -262,7 +262,7 @@ void Scoreboard::fillPanelTextures()
// ENTER NAME // 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}; SDL_FRect rect = {enter_name_pos_.x, enter_name_pos_.y, 5.0f, 7.0f};
// Recorre todos los slots de letras del nombre // Recorre todos los slots de letras del nombre
@@ -298,7 +298,7 @@ void Scoreboard::fillPanelTextures()
text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i])); text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i]));
// NAME // 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 */ /* 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)); // 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 +309,12 @@ void Scoreboard::fillPanelTextures()
case ScoreboardMode::GAME_COMPLETED: case ScoreboardMode::GAME_COMPLETED:
{ {
// 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"));
// SCORE // SCORE
if (time_counter_ % 10 < 8) 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])); text_scoreboard_->writeCentered(slot4_4_.x, slot4_4_.y - 2, updateScoreText(score_[i]));
} }
} }
@@ -342,7 +342,7 @@ void Scoreboard::fillBackgroundTexture()
SDL_RenderClear(renderer_); SDL_RenderClear(renderer_);
// Copia las texturas de los paneles // Copia las texturas de los paneles
for (int i = 0; i < [SCOREBOARD] MAX_PANELS; ++i) for (int i = 0; i < SCOREBOARD_MAX_PANELS; ++i)
{ {
SDL_RenderTexture(renderer_, panel_texture_[i], nullptr, &panel_[i].pos); SDL_RenderTexture(renderer_, panel_texture_[i], nullptr, &panel_[i].pos);
} }
@@ -358,8 +358,8 @@ void Scoreboard::fillBackgroundTexture()
void Scoreboard::recalculateAnchors() void Scoreboard::recalculateAnchors()
{ {
// Recalcula la posición y el tamaño de los paneles // Recalcula la posición y el tamaño de los paneles
const float panel_width = (float)rect_.w / (float)[SCOREBOARD] MAX_PANELS; const float panel_width = (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 = roundf(panel_width * i); panel_[i].pos.x = roundf(panel_width * i);
panel_[i].pos.y = 0; panel_[i].pos.y = 0;
@@ -427,7 +427,7 @@ void Scoreboard::createPanelTextures()
panel_texture_.clear(); panel_texture_.clear();
// Crea las texturas para cada panel_ // Crea las texturas para cada panel_
for (int i = 0; i < [SCOREBOARD] MAX_PANELS; ++i) for (int i = 0; i < SCOREBOARD_MAX_PANELS; ++i)
{ {
SDL_Texture *tex = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, panel_[i].pos.w, panel_[i].pos.h); SDL_Texture *tex = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, panel_[i].pos.w, panel_[i].pos.h);
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND); SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);

View File

@@ -15,10 +15,10 @@ class Text;
class Texture; class Texture;
// --- Defines --- // --- Defines ---
constexpr int [SCOREBOARD] LEFT_PANEL = 0; constexpr int SCOREBOARD_LEFT_PANEL = 0;
constexpr int [SCOREBOARD] CENTER_PANEL = 1; constexpr int SCOREBOARD_CENTER_PANEL = 1;
constexpr int [SCOREBOARD] RIGHT_PANEL = 2; constexpr int SCOREBOARD_RIGHT_PANEL = 2;
constexpr int [SCOREBOARD] MAX_PANELS = 3; constexpr int SCOREBOARD_MAX_PANELS = 3;
// --- Enums --- // --- Enums ---
enum class ScoreboardMode : int enum class ScoreboardMode : int
@@ -83,13 +83,13 @@ private:
std::vector<SDL_Texture *> panel_texture_; // Texturas para dibujar cada panel std::vector<SDL_Texture *> panel_texture_; // Texturas para dibujar cada panel
// --- Variables de estado --- // --- Variables de estado ---
std::string name_[[SCOREBOARD] MAX_PANELS] = {}; // Nombre de cada jugador std::string name_[SCOREBOARD_MAX_PANELS] = {}; // Nombre de cada jugador
std::string record_name_[[SCOREBOARD] MAX_PANELS] = {}; // Nombre introducido para la tabla de records std::string record_name_[SCOREBOARD_MAX_PANELS] = {}; // Nombre introducido para la tabla de records
size_t selector_pos_[[SCOREBOARD] MAX_PANELS] = {}; // Posición del selector de letra para introducir el nombre size_t selector_pos_[SCOREBOARD_MAX_PANELS] = {}; // Posición del selector de letra para introducir el nombre
int score_[[SCOREBOARD] MAX_PANELS] = {}; // Puntuación de los jugadores int score_[SCOREBOARD_MAX_PANELS] = {}; // Puntuación de los jugadores
float mult_[[SCOREBOARD] MAX_PANELS] = {}; // Multiplicador de los jugadores float mult_[SCOREBOARD_MAX_PANELS] = {}; // Multiplicador de los jugadores
int continue_counter_[[SCOREBOARD] MAX_PANELS] = {}; // Tiempo para continuar de los jugadores int continue_counter_[SCOREBOARD_MAX_PANELS] = {}; // Tiempo para continuar de los jugadores
Panel panel_[[SCOREBOARD] MAX_PANELS] = {}; // Lista con todos los paneles del marcador Panel panel_[SCOREBOARD_MAX_PANELS] = {}; // Lista con todos los paneles del marcador
int stage_ = 1; // Número de fase actual int stage_ = 1; // Número de fase actual
int hi_score_ = 0; // Máxima puntuación int hi_score_ = 0; // Máxima puntuación
float power_ = 0; // Poder actual de la fase float power_ = 0; // Poder actual de la fase

View File

@@ -29,7 +29,7 @@ namespace section
GAME_PLAY_1P, // Jugar 1 jugador GAME_PLAY_1P, // Jugar 1 jugador
GAME_PLAY_2P, // Jugar 2 jugadores GAME_PLAY_2P, // Jugar 2 jugadores
TITLE_TIME_OUT, // Timeout en el título TITLE_TIME_OUT, // Timeout en el título
[TITLE] PRESS_BUTTON_TO_PLAY, // Opción 1 en el título TITLE_1, // Opción 1 en el título
TITLE_2, // Opción 2 en el título TITLE_2, // Opción 2 en el título
QUIT_WITH_KEYBOARD, // Salir con teclado QUIT_WITH_KEYBOARD, // Salir con teclado
QUIT_WITH_CONTROLLER, // Salir con mando QUIT_WITH_CONTROLLER, // Salir con mando

View File

@@ -9,6 +9,7 @@
#include "section.h" // Para Name, name, Options, options, AttractMode #include "section.h" // Para Name, name, Options, options, AttractMode
#include "audio.h" #include "audio.h"
#include <unordered_map> #include <unordered_map>
#include "lang.h"
// Singleton // Singleton
ServiceMenu *ServiceMenu::instance_ = nullptr; ServiceMenu *ServiceMenu::instance_ = nullptr;
@@ -67,7 +68,7 @@ void ServiceMenu::render()
// TITULO // TITULO
y += line_height_; y += line_height_;
title_text_->writeDX(TEXT_COLOR | TEXT_CENTER, param.game.game_area.center_x, y, "SERVICE MENU", -4, title_color_); title_text_->writeDX(TEXT_COLOR | TEXT_CENTER, param.game.game_area.center_x, y, lang::getText("[SERVICE_MENU] TITLE"), -4, title_color_);
// LINEA // LINEA
y += line_height_ * 2; y += line_height_ * 2;
@@ -109,7 +110,7 @@ void ServiceMenu::update()
void ServiceMenu::setAnchors() void ServiceMenu::setAnchors()
{ {
line_height_ = element_text_->getCharacterSize() + 5; line_height_ = element_text_->getCharacterSize() + 5;
width_ = 220; width_ = 240;
height_ = calculateMenuHeight(); height_ = calculateMenuHeight();
rect_ = { rect_ = {
(param.game.width - width_) / 2, (param.game.width - width_) / 2,
@@ -212,19 +213,19 @@ void ServiceMenu::selectOption()
// Opción // Opción
if (display_options_.at(selected_).behavior == OptionBehavior::SELECT) if (display_options_.at(selected_).behavior == OptionBehavior::SELECT)
{ {
if (display_options_.at(selected_).caption == "RESET") if (display_options_.at(selected_).caption == lang::getText("[SERVICE_MENU] RESET"))
{ {
section::name = section::Name::INIT; section::name = section::Name::INIT;
toggle(); toggle();
return; return;
} }
else if (display_options_.at(selected_).caption == "QUIT") else if (display_options_.at(selected_).caption == lang::getText("[SERVICE_MENU] QUIT"))
{ {
section::name = section::Name::QUIT; section::name = section::Name::QUIT;
section::options = section::Options::QUIT_WITH_KEYBOARD; section::options = section::Options::QUIT_WITH_KEYBOARD;
return; return;
} }
else if (display_options_.at(selected_).caption == "SHUTDOWN") else if (display_options_.at(selected_).caption == lang::getText("[SERVICE_MENU] SHUTDOWN"))
{ {
section::name = section::Name::QUIT; section::name = section::Name::QUIT;
section::options = section::Options::QUIT_WITH_CONTROLLER; section::options = section::Options::QUIT_WITH_CONTROLLER;
@@ -255,32 +256,31 @@ void ServiceMenu::moveBack()
void ServiceMenu::initializeOptions() void ServiceMenu::initializeOptions()
{ {
// Video // Video
options_.emplace_back("FULLSCREEN", SettingsGroup::VIDEO, OptionBehavior::ADJUST, &options.video.fullscreen, ValueType::BOOL); options_.emplace_back(lang::getText("[SERVICE_MENU] FULLSCREEN"), SettingsGroup::VIDEO, OptionBehavior::ADJUST, &options.video.fullscreen, ValueType::BOOL);
options_.emplace_back("WINDOW SIZE", SettingsGroup::VIDEO, OptionBehavior::ADJUST, &options.window.size, ValueType::INT, 1, options.window.max_size, 1); options_.emplace_back(lang::getText("[SERVICE_MENU] WINDOW_SIZE"), SettingsGroup::VIDEO, OptionBehavior::ADJUST, &options.window.size, ValueType::INT, 1, options.window.max_size, 1);
options_.emplace_back("SHADERS", SettingsGroup::VIDEO, OptionBehavior::ADJUST, &options.video.shaders, ValueType::BOOL); options_.emplace_back(lang::getText("[SERVICE_MENU] SHADERS"), SettingsGroup::VIDEO, OptionBehavior::ADJUST, &options.video.shaders, ValueType::BOOL);
options_.emplace_back("VSYNC", SettingsGroup::VIDEO, OptionBehavior::ADJUST, &options.video.v_sync, ValueType::BOOL); options_.emplace_back(lang::getText("[SERVICE_MENU] VSYNC"), SettingsGroup::VIDEO, OptionBehavior::ADJUST, &options.video.v_sync, ValueType::BOOL);
options_.emplace_back("INTEGER SCALE", SettingsGroup::VIDEO, OptionBehavior::ADJUST, &options.video.integer_scale, ValueType::BOOL); options_.emplace_back(lang::getText("[SERVICE_MENU] INTEGER_SCALE"), SettingsGroup::VIDEO, OptionBehavior::ADJUST, &options.video.integer_scale, ValueType::BOOL);
// Audio // Audio
options_.emplace_back("AUDIO", SettingsGroup::AUDIO, OptionBehavior::ADJUST, &options.audio.enabled, ValueType::BOOL); options_.emplace_back(lang::getText("[SERVICE_MENU] AUDIO"), SettingsGroup::AUDIO, OptionBehavior::ADJUST, &options.audio.enabled, ValueType::BOOL);
options_.emplace_back("MAIN VOLUME", SettingsGroup::AUDIO, OptionBehavior::ADJUST, &options.audio.volume, ValueType::INT, 0, 100, 5); options_.emplace_back(lang::getText("[SERVICE_MENU] MAIN_VOLUME"), SettingsGroup::AUDIO, OptionBehavior::ADJUST, &options.audio.volume, ValueType::INT, 0, 100, 5);
options_.emplace_back("MUSIC VOLUME", SettingsGroup::AUDIO, OptionBehavior::ADJUST, &options.audio.music.volume, ValueType::INT, 0, 100, 5); options_.emplace_back(lang::getText("[SERVICE_MENU] MUSIC_VOLUME"), SettingsGroup::AUDIO, OptionBehavior::ADJUST, &options.audio.music.volume, ValueType::INT, 0, 100, 5);
options_.emplace_back("SFX VOLUME", SettingsGroup::AUDIO, OptionBehavior::ADJUST, &options.audio.sound.volume, ValueType::INT, 0, 100, 5); options_.emplace_back(lang::getText("[SERVICE_MENU] SFX_VOLUME"), SettingsGroup::AUDIO, OptionBehavior::ADJUST, &options.audio.sound.volume, ValueType::INT, 0, 100, 5);
// Game // Game
options_.emplace_back("AUTOFIRE", SettingsGroup::GAME, OptionBehavior::ADJUST, &options.game.autofire, ValueType::BOOL); options_.emplace_back(lang::getText("[SERVICE_MENU] AUTOFIRE"), SettingsGroup::GAME, OptionBehavior::ADJUST, &options.game.autofire, ValueType::BOOL);
// options_.emplace_back("LANG", SettingsGroup::GAME, OptionBehavior::ADJUST, &options.game.language, ValueType::BOOL);
// System // System
options_.emplace_back("RESET", SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE); options_.emplace_back(lang::getText("[SERVICE_MENU] RESET"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE);
options_.emplace_back("QUIT", SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE); options_.emplace_back(lang::getText("[SERVICE_MENU] QUIT"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE);
options_.emplace_back("SHUTDOWN", SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE); options_.emplace_back(lang::getText("[SERVICE_MENU] SHUTDOWN"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE);
// Menu principal // Menu principal
options_.emplace_back("VIDEO", SettingsGroup::MAIN, OptionBehavior::SELECT, SettingsGroup::VIDEO); options_.emplace_back(lang::getText("[SERVICE_MENU] VIDEO"), SettingsGroup::MAIN, OptionBehavior::SELECT, SettingsGroup::VIDEO);
options_.emplace_back("AUDIO", SettingsGroup::MAIN, OptionBehavior::SELECT, SettingsGroup::AUDIO); options_.emplace_back(lang::getText("[SERVICE_MENU] AUDIO"), SettingsGroup::MAIN, OptionBehavior::SELECT, SettingsGroup::AUDIO);
options_.emplace_back("GAME", SettingsGroup::MAIN, OptionBehavior::SELECT, SettingsGroup::GAME); options_.emplace_back(lang::getText("[SERVICE_MENU] GAME"), SettingsGroup::MAIN, OptionBehavior::SELECT, SettingsGroup::GAME);
options_.emplace_back("SYSTEM", SettingsGroup::MAIN, OptionBehavior::SELECT, SettingsGroup::SYSTEM); options_.emplace_back(lang::getText("[SERVICE_MENU] SYSTEM"), SettingsGroup::MAIN, OptionBehavior::SELECT, SettingsGroup::SYSTEM);
} }
// Devuelve las opciones del grupo como pares (nombre, valor) // Devuelve las opciones del grupo como pares (nombre, valor)

View File

@@ -6,6 +6,7 @@
#include <memory> #include <memory>
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include "utils.h" #include "utils.h"
#include "lang.h"
class Text; class Text;
@@ -131,7 +132,7 @@ private:
switch (type) switch (type)
{ {
case ValueType::BOOL: case ValueType::BOOL:
return (*(static_cast<bool *>(linked_variable))) ? "ON" : "OFF"; return (*(static_cast<bool *>(linked_variable))) ? lang::getText("[SERVICE_MENU] ON") : lang::getText("[SERVICE_MENU] OFF");
case ValueType::INT: case ValueType::INT:
return std::to_string(*(static_cast<int *>(linked_variable))); return std::to_string(*(static_cast<int *>(linked_variable)));
default: default:

View File

@@ -46,7 +46,7 @@ Title::Title()
Resource::get()->getTexture("smb2.gif")->setPalette(1); Resource::get()->getTexture("smb2.gif")->setPalette(1);
// Asigna valores a otras variables // Asigna valores a otras variables
section::options = section::Options::[TITLE] PRESS_BUTTON_TO_PLAY; section::options = section::Options::TITLE_1;
const bool IS_TITLE_TO_DEMO = (section::attract_mode == section::AttractMode::TITLE_TO_DEMO); const bool IS_TITLE_TO_DEMO = (section::attract_mode == section::AttractMode::TITLE_TO_DEMO);
next_section_ = IS_TITLE_TO_DEMO ? section::Name::GAME_DEMO : section::Name::LOGO; next_section_ = IS_TITLE_TO_DEMO ? section::Name::GAME_DEMO : section::Name::LOGO;
section::attract_mode = IS_TITLE_TO_DEMO ? section::AttractMode::TITLE_TO_LOGO : section::AttractMode::TITLE_TO_DEMO; section::attract_mode = IS_TITLE_TO_DEMO ? section::AttractMode::TITLE_TO_LOGO : section::AttractMode::TITLE_TO_DEMO;

View File

@@ -20,9 +20,9 @@ const Color BG_COLOR = Color(0X27, 0X27, 0X36);
const Color NO_COLOR = Color(0XFF, 0XFF, 0XFF); const Color NO_COLOR = Color(0XFF, 0XFF, 0XFF);
const Color SHADOW_TEXT_COLOR = Color(0X43, 0X43, 0X4F); const Color SHADOW_TEXT_COLOR = Color(0X43, 0X43, 0X4F);
const Color SEPARATOR_COLOR = Color(0X0D, 0X1A, 0X2B); const Color SEPARATOR_COLOR = Color(0X0D, 0X1A, 0X2B);
const Color [SCOREBOARD] EASY_COLOR = Color(0X4B, 0X69, 0X2F); const Color SCOREBOARD_EASY_COLOR = Color(0X4B, 0X69, 0X2F);
const Color [SCOREBOARD] NORMAL_COLOR = Color(0X2E, 0X3F, 0X47); const Color SCOREBOARD_NORMAL_COLOR = Color(0X2E, 0X3F, 0X47);
const Color [SCOREBOARD] HARD_COLOR = Color(0X76, 0X42, 0X8A); const Color SCOREBOARD_HARD_COLOR = Color(0X76, 0X42, 0X8A);
const Color FLASH_COLOR = Color(0XFF, 0XFF, 0XFF); const Color FLASH_COLOR = Color(0XFF, 0XFF, 0XFF);
const Color FADE_COLOR = Color(0X27, 0X27, 0X36); const Color FADE_COLOR = Color(0X27, 0X27, 0X36);
const Color ORANGE_COLOR = Color(0XFF, 0X7A, 0X00); const Color ORANGE_COLOR = Color(0XFF, 0X7A, 0X00);

View File

@@ -115,9 +115,9 @@ extern const Color BG_COLOR;
extern const Color NO_COLOR; extern const Color NO_COLOR;
extern const Color SHADOW_TEXT_COLOR; extern const Color SHADOW_TEXT_COLOR;
extern const Color SEPARATOR_COLOR; extern const Color SEPARATOR_COLOR;
extern const Color [SCOREBOARD] EASY_COLOR; extern const Color SCOREBOARD_EASY_COLOR;
extern const Color [SCOREBOARD] NORMAL_COLOR; extern const Color SCOREBOARD_NORMAL_COLOR;
extern const Color [SCOREBOARD] HARD_COLOR; extern const Color SCOREBOARD_HARD_COLOR;
extern const Color FLASH_COLOR; extern const Color FLASH_COLOR;
extern const Color FADE_COLOR; extern const Color FADE_COLOR;
extern const Color ORANGE_COLOR; extern const Color ORANGE_COLOR;