From 0647eceab7b94dafa6fc6136fa56b8b3f70520b0 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sat, 16 May 2026 23:48:07 +0200 Subject: [PATCH] neteja clang-tidy: enums uint8_t, includes, naming i altres --- source/core/rendering/screen.cpp | 2 +- source/core/resources/resource.cpp | 32 +-- source/core/system/demo.cpp | 1 - source/core/system/director.cpp | 4 +- source/game/entities/balloon.cpp | 2 +- source/game/entities/item.hpp | 9 +- source/game/entities/player.cpp | 5 - source/game/entities/player.hpp | 18 +- source/game/entities/tabe.hpp | 5 +- source/game/gameplay/balloon_formations.cpp | 2 + source/game/gameplay/balloon_formations.hpp | 1 - source/game/gameplay/bullet_manager.cpp | 1 - source/game/gameplay/bullet_manager.hpp | 1 - source/game/gameplay/difficulty.cpp | 12 +- source/game/gameplay/difficulty.hpp | 7 +- source/game/gameplay/game_logo.hpp | 5 +- source/game/gameplay/manage_hiscore_table.cpp | 16 +- source/game/gameplay/scoreboard.cpp | 20 +- source/game/gameplay/scoreboard.hpp | 5 +- source/game/gameplay/stage.hpp | 5 +- source/game/scenes/credits.cpp | 2 +- source/game/scenes/game.cpp | 9 +- source/game/scenes/game.hpp | 13 +- source/game/scenes/hiscore_table.cpp | 42 ++-- source/game/scenes/intro.cpp | 18 +- source/game/scenes/intro.hpp | 9 +- source/game/scenes/preload.hpp | 4 +- source/game/scenes/title.cpp | 5 +- source/game/scenes/title.hpp | 3 +- source/game/ui/menu_option.hpp | 8 +- source/game/ui/menu_renderer.cpp | 4 +- source/game/ui/menu_renderer.hpp | 5 +- source/game/ui/notifier.hpp | 13 +- source/game/ui/service_menu.cpp | 225 +++++++++--------- source/game/ui/service_menu.hpp | 10 +- source/main.cpp | 6 +- source/utils/color.cpp | 8 +- source/utils/color.hpp | 25 +- source/utils/param.cpp | 1 - source/utils/param.hpp | 24 +- source/utils/utils.cpp | 1 - 41 files changed, 300 insertions(+), 288 deletions(-) diff --git a/source/core/rendering/screen.cpp b/source/core/rendering/screen.cpp index ee27a5f..9770478 100644 --- a/source/core/rendering/screen.cpp +++ b/source/core/rendering/screen.cpp @@ -351,7 +351,7 @@ void Screen::renderInfo() const { if (!debug_info_.show) { return; } const Color GOLD(0xFF, 0xD7, 0x00); - const Color GOLD_SHADOW = GOLD.DARKEN(150); + const Color GOLD_SHADOW = GOLD.darken(150); const std::string INFO_TEXT = buildDebugInfoText(); const int TEXT_WIDTH = debug_info_.text->length(INFO_TEXT); diff --git a/source/core/resources/resource.cpp b/source/core/resources/resource.cpp index ffba136..48dca82 100644 --- a/source/core/resources/resource.cpp +++ b/source/core/resources/resource.cpp @@ -606,11 +606,11 @@ void Resource::createPlayerTextures() { if (palette_idx == 0) { // Textura 0 - usar la ya cargada y modificar solo paleta 0 (default_shirt) texture = getTexture(player.base_texture); - texture->setPaletteColor(0, 16, param.player.default_shirt[player_idx].darkest.TO_UINT32()); - texture->setPaletteColor(0, 17, param.player.default_shirt[player_idx].dark.TO_UINT32()); - texture->setPaletteColor(0, 18, param.player.default_shirt[player_idx].base.TO_UINT32()); - texture->setPaletteColor(0, 19, param.player.default_shirt[player_idx].light.TO_UINT32()); - texture->setPaletteColor(0, 56, param.player.outline_color[player_idx].TO_UINT32()); + texture->setPaletteColor(0, 16, param.player.default_shirt[player_idx].darkest.toUint32()); + texture->setPaletteColor(0, 17, param.player.default_shirt[player_idx].dark.toUint32()); + texture->setPaletteColor(0, 18, param.player.default_shirt[player_idx].base.toUint32()); + texture->setPaletteColor(0, 19, param.player.default_shirt[player_idx].light.toUint32()); + texture->setPaletteColor(0, 56, param.player.outline_color[player_idx].toUint32()); } else { // Crear textura nueva desde archivo usando ResourceHelper texture = std::make_shared(Screen::get()->getRenderer(), TEXTURE_FILE_PATH); @@ -622,18 +622,18 @@ void Resource::createPlayerTextures() { if (palette_idx == 1) { // Textura 1 - modificar solo paleta 1 (one_coffee_shirt) - texture->setPaletteColor(1, 16, param.player.one_coffee_shirt[player_idx].darkest.TO_UINT32()); - texture->setPaletteColor(1, 17, param.player.one_coffee_shirt[player_idx].dark.TO_UINT32()); - texture->setPaletteColor(1, 18, param.player.one_coffee_shirt[player_idx].base.TO_UINT32()); - texture->setPaletteColor(1, 19, param.player.one_coffee_shirt[player_idx].light.TO_UINT32()); - texture->setPaletteColor(1, 56, param.player.outline_color[player_idx].TO_UINT32()); + texture->setPaletteColor(1, 16, param.player.one_coffee_shirt[player_idx].darkest.toUint32()); + texture->setPaletteColor(1, 17, param.player.one_coffee_shirt[player_idx].dark.toUint32()); + texture->setPaletteColor(1, 18, param.player.one_coffee_shirt[player_idx].base.toUint32()); + texture->setPaletteColor(1, 19, param.player.one_coffee_shirt[player_idx].light.toUint32()); + texture->setPaletteColor(1, 56, param.player.outline_color[player_idx].toUint32()); } else if (palette_idx == 2) { // Textura 2 - modificar solo paleta 2 (two_coffee_shirt) - texture->setPaletteColor(2, 16, param.player.two_coffee_shirt[player_idx].darkest.TO_UINT32()); - texture->setPaletteColor(2, 17, param.player.two_coffee_shirt[player_idx].dark.TO_UINT32()); - texture->setPaletteColor(2, 18, param.player.two_coffee_shirt[player_idx].base.TO_UINT32()); - texture->setPaletteColor(2, 19, param.player.two_coffee_shirt[player_idx].light.TO_UINT32()); - texture->setPaletteColor(2, 56, param.player.outline_color[player_idx].TO_UINT32()); + texture->setPaletteColor(2, 16, param.player.two_coffee_shirt[player_idx].darkest.toUint32()); + texture->setPaletteColor(2, 17, param.player.two_coffee_shirt[player_idx].dark.toUint32()); + texture->setPaletteColor(2, 18, param.player.two_coffee_shirt[player_idx].base.toUint32()); + texture->setPaletteColor(2, 19, param.player.two_coffee_shirt[player_idx].light.toUint32()); + texture->setPaletteColor(2, 56, param.player.outline_color[player_idx].toUint32()); } // Textura 3 (palette_idx == 3) - no modificar nada, usar colores originales } @@ -797,7 +797,7 @@ void Resource::renderProgress() { const bool WAITING_FOR_INPUT = isLoadDone() && Options::loading.wait_for_input; auto text_color = param.resource.color; - auto bar_color = param.resource.color.DARKEN(100); + auto bar_color = param.resource.color.darken(100); const auto TEXT_HEIGHT = loading_text_->getCharacterSize(); // Dibuja el interior de la barra de progreso diff --git a/source/core/system/demo.cpp b/source/core/system/demo.cpp index a0cd64f..eb30648 100644 --- a/source/core/system/demo.cpp +++ b/source/core/system/demo.cpp @@ -6,7 +6,6 @@ #include // Para runtime_error #include "core/resources/resource_helper.hpp" // Para ResourceHelper -#include "utils/utils.hpp" // Para getFileName // Carga el fichero de datos para la demo auto loadDemoDataFromFile(const std::string& file_path) -> DemoData { diff --git a/source/core/system/director.cpp b/source/core/system/director.cpp index d090a5f..09a687c 100644 --- a/source/core/system/director.cpp +++ b/source/core/system/director.cpp @@ -473,7 +473,7 @@ auto Director::iterate() -> SDL_AppResult { // Ejecuta un frame de la sección activa if (preload_) { - preload_->iterate(); + Preload::iterate(); } else if (logo_) { logo_->iterate(); } else if (intro_) { @@ -500,7 +500,7 @@ auto Director::handleEvent(const SDL_Event& event) -> SDL_AppResult { // Reenvía a la sección activa if (preload_) { - preload_->handleEvent(event); + Preload::handleEvent(event); } else if (logo_) { logo_->handleEvent(event); } else if (intro_) { diff --git a/source/game/entities/balloon.cpp b/source/game/entities/balloon.cpp index ac0b2f9..06130f9 100644 --- a/source/game/entities/balloon.cpp +++ b/source/game/entities/balloon.cpp @@ -7,7 +7,7 @@ #include "core/audio/audio.hpp" // Para Audio #include "core/rendering/sprite/animated_sprite.hpp" // Para AnimatedSprite #include "core/rendering/sprite/sprite.hpp" // Para Sprite -#include "core/rendering/texture.hpp" // Para Texture +#include "core/rendering/texture.hpp" // IWYU pragma: keep #include "utils/param.hpp" // Para Param, ParamBalloon, param // Constructor diff --git a/source/game/entities/item.hpp b/source/game/entities/item.hpp index a17fde3..7a1f837 100644 --- a/source/game/entities/item.hpp +++ b/source/game/entities/item.hpp @@ -2,9 +2,10 @@ #include // Para SDL_FRect, Uint16 -#include // Para shared_ptr, unique_ptr -#include // Para string -#include // Para vector +#include // Para std::uint8_t +#include // Para shared_ptr, unique_ptr +#include // Para string +#include // Para vector #include "core/rendering/sprite/animated_sprite.hpp" // Para AnimatedSprite #include "utils/utils.hpp" // Para Circle @@ -12,7 +13,7 @@ class Texture; // --- Enums --- -enum class ItemType : int { +enum class ItemType : std::uint8_t { DISK = 1, // Disco GAVINA = 2, // Gavina PACMAR = 3, // Pacman diff --git a/source/game/entities/player.cpp b/source/game/entities/player.cpp index ec8f5e8..fd23675 100644 --- a/source/game/entities/player.cpp +++ b/source/game/entities/player.cpp @@ -8,7 +8,6 @@ #include "core/audio/audio.hpp" // Para Audio #include "core/input/input.hpp" // Para Input -#include "core/input/input_types.hpp" // Para InputAction #include "core/rendering/sprite/animated_sprite.hpp" // Para AnimatedSprite #include "core/rendering/texture.hpp" // Para Texture #include "core/resources/asset.hpp" // Para Asset @@ -1135,8 +1134,6 @@ void Player::updateFiringStateFromVisual() { firing_state_ = State::RECOILING_RIGHT; break; case State::FIRING_UP: - firing_state_ = State::RECOILING_UP; - break; default: firing_state_ = State::RECOILING_UP; break; @@ -1152,8 +1149,6 @@ void Player::updateFiringStateFromVisual() { firing_state_ = State::COOLING_RIGHT; break; case State::FIRING_UP: - firing_state_ = State::COOLING_UP; - break; default: firing_state_ = State::COOLING_UP; break; diff --git a/source/game/entities/player.hpp b/source/game/entities/player.hpp index 1ab93ef..df612af 100644 --- a/source/game/entities/player.hpp +++ b/source/game/entities/player.hpp @@ -2,12 +2,12 @@ #include // Para SDL_FRect, SDL_FlipMode -#include // Para size_t -#include // Para pair -#include // Para shared_ptr, unique_ptr -#include // Para basic_string, string -#include // Para move, pair -#include // Para vector +#include // Para size_t +#include // Para std::uint8_t, std::int8_t +#include // Para shared_ptr, unique_ptr +#include // Para basic_string, string +#include // Para move, pair +#include // Para vector #include "core/input/input.hpp" // for Input #include "core/rendering/sprite/animated_sprite.hpp" // for AnimatedSprite @@ -49,14 +49,14 @@ class Player { }; // --- Enums --- - enum class Id : int { + enum class Id : std::int8_t { NO_PLAYER = -1, // Sin jugador BOTH_PLAYERS = 0, // Ambos jugadores PLAYER1 = 1, // Jugador 1 PLAYER2 = 2 // Jugador 2 }; - enum class State { + enum class State : std::uint8_t { // Estados de movimiento WALKING_LEFT, // Caminando hacia la izquierda WALKING_RIGHT, // Caminando hacia la derecha @@ -293,7 +293,7 @@ class Player { bool can_fire_new_system_ = true; // true si puede disparar ahora mismo // LÍNEA 2: SISTEMA VISUAL (Animaciones) - enum class VisualFireState { + enum class VisualFireState : std::uint8_t { NORMAL, // Brazo en posición neutral AIMING, // Brazo alzado (disparando) RECOILING, // Brazo en retroceso diff --git a/source/game/entities/tabe.hpp b/source/game/entities/tabe.hpp index 6161b81..d1e4910 100644 --- a/source/game/entities/tabe.hpp +++ b/source/game/entities/tabe.hpp @@ -2,6 +2,7 @@ #include // Para Uint32, SDL_GetTicks, SDL_FRect +#include // Para std::uint8_t #include // Para rand #include // Para unique_ptr @@ -11,12 +12,12 @@ class Tabe { public: // --- Enumeraciones para dirección y estado --- - enum class Direction : int { + enum class Direction : std::uint8_t { TO_THE_LEFT = 0, TO_THE_RIGHT = 1, }; - enum class State : int { + enum class State : std::uint8_t { FLY = 0, HIT = 1, }; diff --git a/source/game/gameplay/balloon_formations.cpp b/source/game/gameplay/balloon_formations.cpp index 8c66904..4cc3392 100644 --- a/source/game/gameplay/balloon_formations.cpp +++ b/source/game/gameplay/balloon_formations.cpp @@ -201,6 +201,8 @@ auto BalloonFormations::evaluateSimpleExpression(const std::string& expr, const return left_val * right_val; case '/': return right_val != 0 ? left_val / right_val : 0; + default: + break; // Inalcanzable: el if exterior solo deja pasar '+', '-', '*', '/' } } } diff --git a/source/game/gameplay/balloon_formations.hpp b/source/game/gameplay/balloon_formations.hpp index 58ea784..74eb78a 100644 --- a/source/game/gameplay/balloon_formations.hpp +++ b/source/game/gameplay/balloon_formations.hpp @@ -1,7 +1,6 @@ #pragma once #include // Para size_t -#include // Para pair #include // Para map #include // Para optional #include // Para string diff --git a/source/game/gameplay/bullet_manager.cpp b/source/game/gameplay/bullet_manager.cpp index 89629b3..72c395c 100644 --- a/source/game/gameplay/bullet_manager.cpp +++ b/source/game/gameplay/bullet_manager.cpp @@ -1,6 +1,5 @@ #include "game/gameplay/bullet_manager.hpp" -#include // Para remove_if #include #include "game/entities/bullet.hpp" // Para Bullet diff --git a/source/game/gameplay/bullet_manager.hpp b/source/game/gameplay/bullet_manager.hpp index c731be1..fe976e5 100644 --- a/source/game/gameplay/bullet_manager.hpp +++ b/source/game/gameplay/bullet_manager.hpp @@ -5,7 +5,6 @@ #include // Para function #include // Para list #include // Para shared_ptr -#include // Para vector #include "game/entities/bullet.hpp" // for Bullet diff --git a/source/game/gameplay/difficulty.cpp b/source/game/gameplay/difficulty.cpp index 05628ac..089736d 100644 --- a/source/game/gameplay/difficulty.cpp +++ b/source/game/gameplay/difficulty.cpp @@ -19,19 +19,19 @@ namespace Difficulty { } auto getNameFromCode(Code code) -> std::string { - const auto it = std::ranges::find_if(difficulties_list, + const auto IT = std::ranges::find_if(difficulties_list, [code](const auto& difficulty) { return difficulty.code == code; }); - if (it != difficulties_list.end()) { - return it->name; + if (IT != difficulties_list.end()) { + return IT->name; } return !difficulties_list.empty() ? difficulties_list.front().name : "Unknown"; } auto getCodeFromName(const std::string& name) -> Code { - const auto it = std::ranges::find_if(difficulties_list, + const auto IT = std::ranges::find_if(difficulties_list, [&name](const auto& difficulty) { return difficulty.name == name; }); - if (it != difficulties_list.end()) { - return it->code; + if (IT != difficulties_list.end()) { + return IT->code; } return !difficulties_list.empty() ? difficulties_list.front().code : Code::NORMAL; } diff --git a/source/game/gameplay/difficulty.hpp b/source/game/gameplay/difficulty.hpp index cb22370..d3f0411 100644 --- a/source/game/gameplay/difficulty.hpp +++ b/source/game/gameplay/difficulty.hpp @@ -1,12 +1,13 @@ #pragma once -#include // Para string -#include // Para vector +#include // Para std::uint8_t +#include // Para string +#include // Para vector namespace Difficulty { // --- Enums --- - enum class Code { + enum class Code : std::uint8_t { EASY = 0, // Dificultad fácil NORMAL = 1, // Dificultad normal HARD = 2, // Dificultad difícil diff --git a/source/game/gameplay/game_logo.hpp b/source/game/gameplay/game_logo.hpp index eaf2f3a..801cc3e 100644 --- a/source/game/gameplay/game_logo.hpp +++ b/source/game/gameplay/game_logo.hpp @@ -1,6 +1,7 @@ #pragma once -#include // Para unique_ptr, shared_ptr +#include // Para std::uint8_t +#include // Para unique_ptr, shared_ptr #include "core/rendering/sprite/animated_sprite.hpp" // Para AnimatedSprite #include "core/rendering/sprite/smart_sprite.hpp" // Para SmartSprite @@ -36,7 +37,7 @@ class GameLogo { private: // --- Enums --- - enum class Status { + enum class Status : std::uint8_t { DISABLED, // Deshabilitado MOVING, // En movimiento SHAKING, // Temblando diff --git a/source/game/gameplay/manage_hiscore_table.cpp b/source/game/gameplay/manage_hiscore_table.cpp index b2cde74..e8c9483 100644 --- a/source/game/gameplay/manage_hiscore_table.cpp +++ b/source/game/gameplay/manage_hiscore_table.cpp @@ -2,15 +2,13 @@ #include // Para SDL_ReadIO, SDL_WriteIO, SDL_CloseIO, SDL_GetError, SDL_IOFromFile, SDL_LogError, SDL_LogCategory, SDL_LogInfo -#include // Para __sort_fn, sort -#include // Para array -#include // Para identity -#include // Para std::setw, std::setfill -#include // Para std::cout -#include // Para distance -#include // Para accumulate -#include // Para __find_if_fn, find_if -#include // Para move +#include // Para sort, ranges::find_if, ranges::sort +#include // Para array +#include // Para std::setw, std::setfill +#include // Para std::cout +#include // Para distance +#include // Para accumulate +#include // Para move #include "utils/utils.hpp" // Para getFileName diff --git a/source/game/gameplay/scoreboard.cpp b/source/game/gameplay/scoreboard.cpp index 94e9454..00a6184 100644 --- a/source/game/gameplay/scoreboard.cpp +++ b/source/game/gameplay/scoreboard.cpp @@ -79,7 +79,7 @@ Scoreboard::Scoreboard() fillBackgroundTexture(); // Inicializa el ciclo de colores para el nombre - name_color_cycle_ = Colors::generateMirroredCycle(color_.INVERSE(), ColorCycleStyle::VIBRANT); + name_color_cycle_ = Colors::generateMirroredCycle(color_.inverse(), ColorCycleStyle::VIBRANT); animated_color_ = name_color_cycle_.at(0); } @@ -337,13 +337,13 @@ void Scoreboard::render() { void Scoreboard::setColor(Color color) { // Actualiza las variables de colores color_ = color; - text_color1_ = param.scoreboard.text_autocolor ? color_.LIGHTEN(100) : param.scoreboard.text_color1; - text_color2_ = param.scoreboard.text_autocolor ? color_.LIGHTEN(150) : param.scoreboard.text_color2; + text_color1_ = param.scoreboard.text_autocolor ? color_.lighten(100) : param.scoreboard.text_color1; + text_color2_ = param.scoreboard.text_autocolor ? color_.lighten(150) : param.scoreboard.text_color2; // Aplica los colores power_meter_sprite_->getTexture()->setColor(text_color2_); fillBackgroundTexture(); - name_color_cycle_ = Colors::generateMirroredCycle(color_.INVERSE(), ColorCycleStyle::VIBRANT); + name_color_cycle_ = Colors::generateMirroredCycle(color_.inverse(), ColorCycleStyle::VIBRANT); } // Establece el valor de la variable @@ -383,9 +383,9 @@ void Scoreboard::fillPanelTextures() { } // Interpolar entre color base y color aclarado - Color target_color = color_.LIGHTEN(PANEL_PULSE_LIGHTEN_AMOUNT); + Color target_color = color_.lighten(PANEL_PULSE_LIGHTEN_AMOUNT); // Color target_color = color_.INVERSE(); - background_color = color_.LERP(target_color, pulse_intensity); + background_color = color_.lerp(target_color, pulse_intensity); background_color.a = 255; // Opaco durante el pulso } @@ -716,7 +716,7 @@ void Scoreboard::createPanelTextures() { // Dibuja la linea que separa la zona de juego del marcador void Scoreboard::renderSeparator() { // Dibuja la linea que separa el marcador de la zona de juego - auto color = param.scoreboard.separator_autocolor ? color_.DARKEN() : param.scoreboard.separator_color; + auto color = param.scoreboard.separator_autocolor ? color_.darken() : param.scoreboard.separator_color; SDL_SetRenderDrawColor(renderer_, color.r, color.g, color.b, 255); SDL_RenderLine(renderer_, 0, 0, rect_.w, 0); } @@ -755,7 +755,7 @@ void Scoreboard::renderCarousel(size_t panel_index, int center_x, int y) { } const float FRACTIONAL_OFFSET = frac; - const int PIXEL_OFFSET = static_cast((FRACTIONAL_OFFSET * CHAR_STEP) + 0.5F); + const int PIXEL_OFFSET = static_cast(std::lround(FRACTIONAL_OFFSET * CHAR_STEP)); // Índice base en la lista de caracteres (posición central) const int BASE_INDEX = static_cast(std::floor(carousel_pos)); @@ -790,13 +790,13 @@ void Scoreboard::renderCarousel(size_t panel_index, int center_x, int y) { if (DISTANCE_FROM_CENTER < 0.5F) { // Letra central → transiciona hacia animated_color_ float lerp_to_animated = DISTANCE_FROM_CENTER / 0.5F; // 0.0 a 1.0 - letter_color = animated_color_.LERP(text_color1_, lerp_to_animated); + letter_color = animated_color_.lerp(text_color1_, lerp_to_animated); } else { // Letras alejadas → degradan hacia color_ base float base_lerp = (DISTANCE_FROM_CENTER - 0.5F) / (HALF_VISIBLE - 0.5F); base_lerp = std::min(base_lerp, 1.0F); const float LERP_FACTOR = base_lerp * 0.85F; - letter_color = text_color1_.LERP(color_, LERP_FACTOR); + letter_color = text_color1_.lerp(color_, LERP_FACTOR); } // Calcular posición X de la letra diff --git a/source/game/gameplay/scoreboard.hpp b/source/game/gameplay/scoreboard.hpp index ba49747..77ca07d 100644 --- a/source/game/gameplay/scoreboard.hpp +++ b/source/game/gameplay/scoreboard.hpp @@ -4,6 +4,7 @@ #include // Para array #include // Para size_t +#include // Para std::uint8_t #include // Para shared_ptr, unique_ptr #include // Para string, basic_string #include // Para vector @@ -21,14 +22,14 @@ class Texture; class Scoreboard { public: // --- Enums --- - enum class Id : size_t { + enum class Id : std::uint8_t { LEFT = 0, CENTER = 1, RIGHT = 2, SIZE = 3 }; - enum class Mode : int { + enum class Mode : std::uint8_t { SCORE, STAGE_INFO, CONTINUE, diff --git a/source/game/gameplay/stage.hpp b/source/game/gameplay/stage.hpp index c0539ee..63fe7a4 100644 --- a/source/game/gameplay/stage.hpp +++ b/source/game/gameplay/stage.hpp @@ -1,6 +1,7 @@ #pragma once #include // Para size_t +#include // Para std::uint8_t #include // Para function #include // Para optional #include // Para basic_string, string @@ -9,12 +10,12 @@ #include "core/system/stage_interface.hpp" // for IStageInfo // --- Enums --- -enum class PowerCollectionState { +enum class PowerCollectionState : std::uint8_t { ENABLED, // Recolección habilitada DISABLED // Recolección deshabilitada }; -enum class StageStatus { +enum class StageStatus : std::uint8_t { LOCKED, // Fase bloqueada IN_PROGRESS, // Fase en progreso COMPLETED // Fase completada diff --git a/source/game/scenes/credits.cpp b/source/game/scenes/credits.cpp index b1ccd73..968681e 100644 --- a/source/game/scenes/credits.cpp +++ b/source/game/scenes/credits.cpp @@ -726,7 +726,7 @@ void Credits::drawBorderRect() { return; // no dibujar } - const Color COLOR = color_.LIGHTEN(); + const Color COLOR = color_.lighten(); SDL_Renderer* rdr = Screen::get()->getRenderer(); SDL_SetRenderDrawColor(rdr, COLOR.r, COLOR.g, COLOR.b, 0xFF); diff --git a/source/game/scenes/game.cpp b/source/game/scenes/game.cpp index 988542a..54ed0e4 100644 --- a/source/game/scenes/game.cpp +++ b/source/game/scenes/game.cpp @@ -16,7 +16,6 @@ #include "core/audio/audio.hpp" // Para Audio #include "core/input/global_inputs.hpp" // Para check #include "core/input/input.hpp" // Para Input -#include "core/input/input_types.hpp" // Para InputAction #include "core/input/pause_manager.hpp" // Para PauseManager #include "core/locale/lang.hpp" // Para getText #include "core/rendering/background.hpp" // Para Background @@ -341,7 +340,7 @@ void Game::updateStage() { // Modificar color de fondo en la última fase if (current_stage_index == total_stages - 1) { // Última fase - background_->setColor(Color(0xdd, 0x19, 0x1d).DARKEN()); + background_->setColor(Color(0xdd, 0x19, 0x1d).darken()); background_->setAlpha(96); } } @@ -2183,10 +2182,10 @@ void Game::handleDebugEvents(const SDL_Event& event) { break; } case SDLK_8: { - const auto it = std::ranges::find_if(players_, + const auto IT = std::ranges::find_if(players_, [](const auto& player) { return player->isPlaying(); }); - if (it != players_.end()) { - createItem(ItemType::COFFEE_MACHINE, (*it)->getPosX(), param.game.game_area.rect.y - Item::COFFEE_MACHINE_HEIGHT); + if (IT != players_.end()) { + createItem(ItemType::COFFEE_MACHINE, (*IT)->getPosX(), param.game.game_area.rect.y - Item::COFFEE_MACHINE_HEIGHT); coffee_machine_enabled_ = true; } break; diff --git a/source/game/scenes/game.hpp b/source/game/scenes/game.hpp index 9f2ea99..4a0f801 100644 --- a/source/game/scenes/game.hpp +++ b/source/game/scenes/game.hpp @@ -2,10 +2,11 @@ #include // Para SDL_Event, SDL_Renderer, SDL_Texture, Uint64 -#include // Para list -#include // Para shared_ptr, unique_ptr -#include // Para string -#include // Para vector +#include // Para std::uint8_t +#include // Para list +#include // Para shared_ptr, unique_ptr +#include // Para string +#include // Para vector #include "core/system/demo.hpp" // for Demo #include "game/entities/bullet.hpp" // for Bullet @@ -31,7 +32,7 @@ class Texture; struct Path; namespace Difficulty { - enum class Code; + enum class Code : std::uint8_t; } // namespace Difficulty // --- Clase Game: núcleo principal del gameplay --- @@ -71,7 +72,7 @@ class Game { using Players = std::vector>; // --- Enums --- - enum class State { + enum class State : std::uint8_t { FADE_IN, // Transición de entrada ENTERING_PLAYER, // Jugador entrando SHOWING_GET_READY_MESSAGE, // Mostrando mensaje de preparado diff --git a/source/game/scenes/hiscore_table.cpp b/source/game/scenes/hiscore_table.cpp index f53ce43..38a9780 100644 --- a/source/game/scenes/hiscore_table.cpp +++ b/source/game/scenes/hiscore_table.cpp @@ -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(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(header_text->writeDXToTexture(Text::COLOR, Lang::getText("[HIGHSCORE_TABLE] CAPTION"), -2, background_fade_color_.INVERSE().LIGHTEN(25))); + header_ = std::make_unique(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(entry_text->writeDXToTexture(Text::SHADOW, LINE, 1, Colors::NO_COLOR_MOD, 1, Colors::SHADOW_TEXT))); + entry_names_.emplace_back(std::make_shared(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; } diff --git a/source/game/scenes/intro.cpp b/source/game/scenes/intro.cpp index f4d3768..2a9cadc 100644 --- a/source/game/scenes/intro.cpp +++ b/source/game/scenes/intro.cpp @@ -392,17 +392,17 @@ void Intro::initSprites() { const CardConfig CARD_CONFIGS[] = { // 0: Entra desde la izquierda. La 1 entra desde la derecha → sale empujada hacia la izquierda - {-CARD_WIDTH, Y_DEST - 20.0F, CARD_ANGLE_0, -S, S * 0.1F, -A, 0.0F, -R}, + {.entry_x = -CARD_WIDTH, .entry_y = Y_DEST - 20.0F, .entry_angle = CARD_ANGLE_0, .exit_vx = -S, .exit_vy = S * 0.1F, .exit_ax = -A, .exit_ay = 0.0F, .exit_rotation = -R}, // 1: Entra desde la derecha. La 2 entra desde arriba → sale empujada hacia abajo - {W + CARD_WIDTH, Y_DEST + 15.0F, CARD_ANGLE_1, S * 0.15F, S, 0.0F, A, R * 1.1}, + {.entry_x = W + CARD_WIDTH, .entry_y = Y_DEST + 15.0F, .entry_angle = CARD_ANGLE_1, .exit_vx = S * 0.15F, .exit_vy = S, .exit_ax = 0.0F, .exit_ay = A, .exit_rotation = R * 1.1}, // 2: Entra desde arriba. La 3 entra desde abajo → sale empujada hacia arriba - {X_DEST + 30.0F, -CARD_HEIGHT, CARD_ANGLE_2, -S * 0.15F, -S, 0.0F, -A, -R * 0.9}, + {.entry_x = X_DEST + 30.0F, .entry_y = -CARD_HEIGHT, .entry_angle = CARD_ANGLE_2, .exit_vx = -S * 0.15F, .exit_vy = -S, .exit_ax = 0.0F, .exit_ay = -A, .exit_rotation = -R * 0.9}, // 3: Entra desde abajo. La 4 entra desde arriba-izquierda → sale empujada hacia abajo-derecha - {X_DEST - 25.0F, H + CARD_HEIGHT, CARD_ANGLE_3, S * 0.8F, S * 0.6F, A * 0.5F, A * 0.4F, R}, + {.entry_x = X_DEST - 25.0F, .entry_y = H + CARD_HEIGHT, .entry_angle = CARD_ANGLE_3, .exit_vx = S * 0.8F, .exit_vy = S * 0.6F, .exit_ax = A * 0.5F, .exit_ay = A * 0.4F, .exit_rotation = R}, // 4: Entra desde arriba-izquierda. La 5 entra desde derecha-abajo → sale empujada hacia arriba-izquierda - {-CARD_WIDTH * 0.5F, -CARD_HEIGHT, CARD_ANGLE_4, -S * 0.7F, -S * 0.5F, -A * 0.5F, -A * 0.3F, -R * 1.2}, + {.entry_x = -CARD_WIDTH * 0.5F, .entry_y = -CARD_HEIGHT, .entry_angle = CARD_ANGLE_4, .exit_vx = -S * 0.7F, .exit_vy = -S * 0.5F, .exit_ax = -A * 0.5F, .exit_ay = -A * 0.3F, .exit_rotation = -R * 1.2}, // 5: Entra desde la derecha-abajo. Última: sale hacia la izquierda suave (viento) - {W + CARD_WIDTH, H * 0.6F, CARD_ANGLE_5, -S * 0.6F, -S * 0.1F, -A * 0.5F, 0.0F, -R * 0.7}, + {.entry_x = W + CARD_WIDTH, .entry_y = H * 0.6F, .entry_angle = CARD_ANGLE_5, .exit_vx = -S * 0.6F, .exit_vy = -S * 0.1F, .exit_ax = -A * 0.5F, .exit_ay = 0.0F, .exit_rotation = -R * 0.7}, }; // Inicializa los CardSprites @@ -534,15 +534,15 @@ void Intro::updatePostState() { if (ELAPSED_TIME >= POST_BG_STOP_DELAY_S) { tiled_bg_->stopGracefully(); - if (!bg_color_.IS_EQUAL_TO(param.title.bg_color)) { - bg_color_ = bg_color_.APPROACH_TO(param.title.bg_color, 1); + if (!bg_color_.isEqualTo(param.title.bg_color)) { + bg_color_ = bg_color_.approachTo(param.title.bg_color, 1); } tiled_bg_->setColor(bg_color_); } // Cambia de estado si el fondo se ha detenido y recuperado el color - if (tiled_bg_->isStopped() && bg_color_.IS_EQUAL_TO(param.title.bg_color)) { + if (tiled_bg_->isStopped() && bg_color_.isEqualTo(param.title.bg_color)) { post_state_ = PostState::END; state_start_time_ = SDL_GetTicks() / 1000.0F; } diff --git a/source/game/scenes/intro.hpp b/source/game/scenes/intro.hpp index 497435d..4cdd31c 100644 --- a/source/game/scenes/intro.hpp +++ b/source/game/scenes/intro.hpp @@ -2,8 +2,9 @@ #include // Para Uint32, Uint64 -#include // Para unique_ptr -#include // Para vector +#include // Para std::uint8_t +#include // Para unique_ptr +#include // Para vector #include "core/rendering/sprite/card_sprite.hpp" // Para CardSprite #include "core/rendering/tiled_bg.hpp" // Para TiledBG @@ -79,12 +80,12 @@ class Intro { static constexpr double CARD_ANGLE_5 = -7.0; // --- Estados internos --- - enum class State { + enum class State : std::uint8_t { SCENES, POST, }; - enum class PostState { + enum class PostState : std::uint8_t { STOP_BG, END, }; diff --git a/source/game/scenes/preload.hpp b/source/game/scenes/preload.hpp index 86b5afa..2bcc592 100644 --- a/source/game/scenes/preload.hpp +++ b/source/game/scenes/preload.hpp @@ -14,6 +14,6 @@ class Preload { ~Preload() = default; // --- Callbacks para el bucle SDL_MAIN_USE_CALLBACKS --- - void iterate(); // Repinta la barra de progreso - void handleEvent(const SDL_Event& event); // Detecta pulsación en modo wait_for_input + static void iterate(); // Repinta la barra de progreso + static void handleEvent(const SDL_Event& event); // Detecta pulsación en modo wait_for_input }; diff --git a/source/game/scenes/title.cpp b/source/game/scenes/title.cpp index 646bda9..9ba4e61 100644 --- a/source/game/scenes/title.cpp +++ b/source/game/scenes/title.cpp @@ -2,14 +2,12 @@ #include // Para SDL_GetTicks, SDL_Event, SDL_Keycode, SDL_PollEvent, SDLK_A, SDLK_C, SDLK_D, SDLK_F, SDLK_S, SDLK_V, SDLK_X, SDLK_Z, SDL_EventType, Uint64 -#include // Para __find_if_fn, find_if #include // Para basic_string, char_traits, operator+, to_string, string #include // Para vector #include "core/audio/audio.hpp" // Para Audio #include "core/input/global_inputs.hpp" // Para check #include "core/input/input.hpp" // Para Input -#include "core/input/input_types.hpp" // Para InputAction #include "core/locale/lang.hpp" // Para getText #include "core/rendering/fade.hpp" // Para Fade #include "core/rendering/screen.hpp" // Para Screen @@ -300,6 +298,9 @@ void Title::updateFade() { Section::options = Section::Options::GAME_PLAY_BOTH; Audio::get()->stopMusic(); break; + + default: + break; // COMBO és un bitmask 2-bit (0..3); arribar ací és impossible. } } } diff --git a/source/game/scenes/title.hpp b/source/game/scenes/title.hpp index 04e09c1..fa18d98 100644 --- a/source/game/scenes/title.hpp +++ b/source/game/scenes/title.hpp @@ -2,6 +2,7 @@ #include // Para SDL_Keycode, SDL_Event, Uint64 +#include // Para std::uint8_t #include // Para shared_ptr, unique_ptr #include // Para string_view #include // Para vector @@ -69,7 +70,7 @@ class Title { static constexpr bool ALLOW_TITLE_ANIMATION_SKIP = false; // Permite saltar la animación del título // --- Enums --- - enum class State { + enum class State : std::uint8_t { LOGO_ANIMATING, // El logo está animándose LOGO_FINISHED, // El logo ha terminado de animarse START_HAS_BEEN_PRESSED, // Se ha pulsado el botón de start diff --git a/source/game/ui/menu_option.hpp b/source/game/ui/menu_option.hpp index bbf3c19..8e817ba 100644 --- a/source/game/ui/menu_option.hpp +++ b/source/game/ui/menu_option.hpp @@ -1,7 +1,9 @@ #pragma once #include // Para max, clamp +#include // Para std::lround #include // Para size_t +#include // Para std::uint8_t #include // Para function #include // Para accumulate #include // Para allocator, string, basic_string, to_string, operator==, char_traits @@ -16,7 +18,7 @@ class MenuOption { public: // --- Enums --- - enum class Behavior { + enum class Behavior : std::uint8_t { ADJUST, // Solo puede ajustar valor (como IntOption, BoolOption, ListOption) SELECT, // Solo puede ejecutar acción (como ActionOption, FolderOption) BOTH // Puede tanto ajustar como ejecutar acción (como ActionListOption) @@ -119,11 +121,11 @@ class VolumeOption : public MenuOption { [[nodiscard]] auto getBehavior() const -> Behavior override { return Behavior::ADJUST; } [[nodiscard]] auto getValueAsString() const -> std::string override { - int pct = static_cast(*linked_variable_ * 100.0F + 0.5F); + int pct = static_cast(std::lround(*linked_variable_ * 100.0F)); return std::to_string(pct); } void adjustValue(bool adjust_up) override { - int current = static_cast(*linked_variable_ * 100.0F + 0.5F); + int current = static_cast(std::lround(*linked_variable_ * 100.0F)); int new_value = std::clamp(current + (adjust_up ? step_value_ : -step_value_), 0, 100); *linked_variable_ = static_cast(new_value) / 100.0F; } diff --git a/source/game/ui/menu_renderer.cpp b/source/game/ui/menu_renderer.cpp index 4099e0e..7171372 100644 --- a/source/game/ui/menu_renderer.cpp +++ b/source/game/ui/menu_renderer.cpp @@ -69,7 +69,7 @@ void MenuRenderer::render(const ServiceMenu* menu_state) { SDL_RenderFillRect(Screen::get()->getRenderer(), &rect_); // Dibuja el borde - const Color BORDER_COLOR = param.service_menu.title_color.DARKEN(); + const Color BORDER_COLOR = param.service_menu.title_color.darken(); SDL_SetRenderDrawColor(Screen::get()->getRenderer(), BORDER_COLOR.r, BORDER_COLOR.g, BORDER_COLOR.b, 255); SDL_RenderRect(Screen::get()->getRenderer(), &rect_); SDL_RenderRect(Screen::get()->getRenderer(), &border_rect_); @@ -111,7 +111,7 @@ void MenuRenderer::render(const ServiceMenu* menu_state) { // Dibuja las opciones y = options_y_; const auto& option_pairs = menu_state->getOptionPairs(); - const float ROW_HEIGHT = static_cast(options_height_ + options_padding_); + const auto ROW_HEIGHT = static_cast(options_height_ + options_padding_); for (size_t i = 0; i < option_pairs.size(); ++i) { const bool IS_SELECTED = (i == menu_state->getSelectedIndex()); diff --git a/source/game/ui/menu_renderer.hpp b/source/game/ui/menu_renderer.hpp index b8849a0..7859c2e 100644 --- a/source/game/ui/menu_renderer.hpp +++ b/source/game/ui/menu_renderer.hpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -17,7 +18,7 @@ class Text; class MenuRenderer { public: // --- Nuevo: Enum para el modo de posicionamiento --- - enum class PositionMode { + enum class PositionMode : std::uint8_t { CENTERED, // La ventana se centra en el punto especificado FIXED // La esquina superior izquierda coincide con el punto }; @@ -94,7 +95,7 @@ class MenuRenderer { } resize_animation_; struct ShowHideAnimation { - enum class Type { NONE, + enum class Type : std::uint8_t { NONE, SHOWING, HIDING }; Type type = Type::NONE; diff --git a/source/game/ui/notifier.hpp b/source/game/ui/notifier.hpp index 489d94f..f81a2c0 100644 --- a/source/game/ui/notifier.hpp +++ b/source/game/ui/notifier.hpp @@ -2,9 +2,10 @@ #include // Para SDL_FRect, SDL_Renderer -#include // Para shared_ptr -#include // Para basic_string, string -#include // Para vector +#include // Para std::uint8_t +#include // Para shared_ptr +#include // Para basic_string, string +#include // Para vector #include "utils/color.hpp" // Para stringInVector, Color #include "utils/utils.hpp" @@ -17,7 +18,7 @@ class Texture; class Notifier { public: // --- Enums --- - enum class Position { + enum class Position : std::uint8_t { TOP, // Parte superior BOTTOM, // Parte inferior LEFT, // Lado izquierdo @@ -46,14 +47,14 @@ class Notifier { static constexpr float ANIMATION_SPEED_PX_PER_S = 60.0F; // Velocidad de animación (1 pixel/frame @ 60fps) // --- Enums privados --- - enum class State { + enum class State : std::uint8_t { RISING, // Apareciendo STAY, // Visible VANISHING, // Desapareciendo FINISHED, // Terminada }; - enum class Shape { + enum class Shape : std::uint8_t { ROUNDED, // Forma redondeada SQUARED, // Forma cuadrada }; diff --git a/source/game/ui/service_menu.cpp b/source/game/ui/service_menu.cpp index 527f3d1..27d72f6 100644 --- a/source/game/ui/service_menu.cpp +++ b/source/game/ui/service_menu.cpp @@ -8,7 +8,6 @@ #include "core/audio/audio.hpp" // Para Audio #include "core/input/define_buttons.hpp" // Para DefineButtons #include "core/input/input.hpp" // Para Input -#include "core/input/input_types.hpp" // Para InputAction #include "core/locale/lang.hpp" // Para getText, getCodeFromName, getNameFromCode #include "core/rendering/screen.hpp" // Para Screen #include "core/resources/resource.hpp" // Para Resource @@ -252,9 +251,9 @@ void ServiceMenu::applySettingsSettings() { } auto ServiceMenu::getOptionByCaption(const std::string& caption) const -> MenuOption* { - const auto it = std::ranges::find_if(options_, + const auto IT = std::ranges::find_if(options_, [&caption](const auto& option) { return option->getCaption() == caption; }); - return it != options_.end() ? it->get() : nullptr; + return IT != options_.end() ? IT->get() : nullptr; } // --- Getters y otros --- @@ -279,8 +278,16 @@ auto ServiceMenu::countOptionsInGroup(SettingsGroup group) const -> size_t { // Inicializa todas las opciones del menú void ServiceMenu::initializeOptions() { options_.clear(); + addControlsOptions(); + addVideoOptions(); + addAudioOptions(); + addSettingsOptions(); + addSystemOptions(); + addMainMenuOptions(); + setHiddenOptions(); +} - // CONTROLS - Usando ActionListOption para mandos +void ServiceMenu::addControlsOptions() { options_.push_back(std::make_unique( Lang::getText("[SERVICE_MENU] CONTROLLER1"), SettingsGroup::CONTROLS, @@ -292,7 +299,6 @@ void ServiceMenu::initializeOptions() { Options::gamepad_manager.assignGamepadToPlayer(Player::Id::PLAYER1, Input::get()->getGamepadByName(val), val); }, [this]() -> void { - // Acción: configurar botones del mando del jugador 1 auto* gamepad = &Options::gamepad_manager.getGamepad(Player::Id::PLAYER1); if (gamepad->instance != nullptr) { define_buttons_->enable(gamepad); @@ -310,14 +316,12 @@ void ServiceMenu::initializeOptions() { Options::gamepad_manager.assignGamepadToPlayer(Player::Id::PLAYER2, Input::get()->getGamepadByName(val), val); }, [this]() -> void { - // Acción: configurar botones del mando del jugador 2 auto* gamepad = &Options::gamepad_manager.getGamepad(Player::Id::PLAYER2); if (gamepad->instance != nullptr) { define_buttons_->enable(gamepad); } })); - // CONTROLS - Opción para teclado (solo lista, sin acción) options_.push_back(std::make_unique( Lang::getText("[SERVICE_MENU] KEYBOARD"), SettingsGroup::CONTROLS, @@ -325,26 +329,22 @@ void ServiceMenu::initializeOptions() { Lang::getText("[SERVICE_MENU] PLAYER1"), Lang::getText("[SERVICE_MENU] PLAYER2")}, []() -> std::string { - // Devolver el jugador actual asignado al teclado return Options::playerIdToString(Options::getPlayerWhoUsesKeyboard()); }, [](const std::string& val) -> void { - // Asignar el teclado al jugador seleccionado Options::keyboard.assignTo(Options::stringToPlayerId(val)); })); - // CONTROLS - Acción para intercambiar mandos options_.push_back(std::make_unique( Lang::getText("[SERVICE_MENU] SWAP_CONTROLLERS"), SettingsGroup::CONTROLS, [this]() -> void { Options::gamepad_manager.swapPlayers(); - adjustListValues(); // Sincroniza el valor de las opciones de lista (como MANDO1) con los datos reales - updateOptionPairs(); // Actualiza los pares de texto que se van a dibujar + adjustListValues(); + updateOptionPairs(); - // Feedback visual: anima el intercambio de los valores entre - // las filas de MANDO 1 y MANDO 2, imprescindible cuando los dos - // mandos tienen el mismo nombre (el texto no cambia al swap). + // Feedback visual: anima el intercambio de las filas de MANDO 1 y MANDO 2, + // imprescindible cuando ambos mandos tienen el mismo nombre (el texto no cambia). const std::string CAPTION1 = Lang::getText("[SERVICE_MENU] CONTROLLER1"); const std::string CAPTION2 = Lang::getText("[SERVICE_MENU] CONTROLLER2"); size_t idx1 = display_options_.size(); @@ -358,8 +358,9 @@ void ServiceMenu::initializeOptions() { renderer_->startSwapAnimation(idx1, idx2); } })); +} - // VIDEO +void ServiceMenu::addVideoOptions() { options_.push_back(std::make_unique( Lang::getText("[SERVICE_MENU] FULLSCREEN"), SettingsGroup::VIDEO, @@ -373,76 +374,8 @@ void ServiceMenu::initializeOptions() { Options::window.max_zoom, 1)); - // Shader: Desactivat / PostFX / CrtPi - { - std::string disabled_text = Lang::getText("[SERVICE_MENU] SHADER_DISABLED"); - std::vector shader_values = {disabled_text, "PostFX", "CrtPi"}; - auto shader_getter = [disabled_text]() -> std::string { - // NOLINTNEXTLINE(performance-no-automatic-move) -- captura por valor en lambda const, no se puede mover - if (!Options::video.shader.enabled) { return disabled_text; } - return (Options::video.shader.current_shader == Rendering::ShaderType::CRTPI) ? "CrtPi" : "PostFX"; - }; - auto shader_setter = [disabled_text](const std::string& val) { - if (val == disabled_text) { - Options::video.shader.enabled = false; - } else { - Options::video.shader.enabled = true; - const auto TYPE = (val == "CrtPi") ? Rendering::ShaderType::CRTPI : Rendering::ShaderType::POSTFX; - Options::video.shader.current_shader = TYPE; - auto* screen = Screen::get(); - if (screen != nullptr) { - screen->applySettings(); - } - } - Screen::initShaders(); - }; - options_.push_back(std::make_unique( - Lang::getText("[SERVICE_MENU] SHADER"), - SettingsGroup::VIDEO, - shader_values, - shader_getter, - shader_setter)); - } - - // Preset: muestra nombre, cicla circularmente entre presets del shader activo - { - auto preset_getter = []() -> std::string { - if (Options::video.shader.current_shader == Rendering::ShaderType::CRTPI) { - if (Options::crtpi_presets.empty()) { return ""; } - return Options::crtpi_presets.at(static_cast(Options::video.shader.current_crtpi_preset)).name; - } - if (Options::postfx_presets.empty()) { return ""; } - return Options::postfx_presets.at(static_cast(Options::video.shader.current_postfx_preset)).name; - }; - auto preset_adjuster = [](bool up) { - if (Options::video.shader.current_shader == Rendering::ShaderType::CRTPI) { - if (Options::crtpi_presets.empty()) { return; } - const int SIZE = static_cast(Options::crtpi_presets.size()); - Options::video.shader.current_crtpi_preset = up - ? (Options::video.shader.current_crtpi_preset + 1) % SIZE - : (Options::video.shader.current_crtpi_preset + SIZE - 1) % SIZE; - } else { - if (Options::postfx_presets.empty()) { return; } - const int SIZE = static_cast(Options::postfx_presets.size()); - Options::video.shader.current_postfx_preset = up - ? (Options::video.shader.current_postfx_preset + 1) % SIZE - : (Options::video.shader.current_postfx_preset + SIZE - 1) % SIZE; - } - Screen::initShaders(); - }; - auto preset_max_width = [](const Text* text) -> int { - const auto presets_length = [text](int max_w, const auto& p) { return std::max(max_w, text->length(p.name, -2)); }; - int max_w = std::accumulate(Options::postfx_presets.begin(), Options::postfx_presets.end(), 0, presets_length); - return std::accumulate(Options::crtpi_presets.begin(), Options::crtpi_presets.end(), max_w, presets_length); - }; - - options_.push_back(std::make_unique( - Lang::getText("[SERVICE_MENU] SHADER_PRESET"), - SettingsGroup::VIDEO, - preset_getter, - preset_adjuster, - preset_max_width)); - } + addVideoShaderOption(); + addVideoPresetOption(); options_.push_back(std::make_unique( Lang::getText("[SERVICE_MENU] SUPERSAMPLING"), @@ -459,25 +392,97 @@ void ServiceMenu::initializeOptions() { SettingsGroup::VIDEO, &Options::video.integer_scale)); - // FILTER: Nearest / Linear (solo visible en el fallback SDL, sin GPU acelerada) - { - std::vector filter_values = {"Nearest", "Linear"}; - auto filter_getter = []() -> std::string { - return (Options::video.scale_mode == SDL_SCALEMODE_LINEAR) ? "Linear" : "Nearest"; - }; - auto filter_setter = [](const std::string& val) { - Options::video.scale_mode = (val == "Linear") ? SDL_SCALEMODE_LINEAR : SDL_SCALEMODE_NEAREST; - if (Screen::get() != nullptr) { Screen::get()->applyFilter(); } - }; - options_.push_back(std::make_unique( - Lang::getText("[SERVICE_MENU] FILTER"), - SettingsGroup::VIDEO, - filter_values, - filter_getter, - filter_setter)); - } + addVideoFilterOption(); +} - // AUDIO +void ServiceMenu::addVideoShaderOption() { + std::string disabled_text = Lang::getText("[SERVICE_MENU] SHADER_DISABLED"); + std::vector shader_values = {disabled_text, "PostFX", "CrtPi"}; + auto shader_getter = [disabled_text]() -> std::string { + // NOLINTNEXTLINE(performance-no-automatic-move) -- captura por valor en lambda const, no se puede mover + if (!Options::video.shader.enabled) { return disabled_text; } + return (Options::video.shader.current_shader == Rendering::ShaderType::CRTPI) ? "CrtPi" : "PostFX"; + }; + auto shader_setter = [disabled_text](const std::string& val) { + if (val == disabled_text) { + Options::video.shader.enabled = false; + } else { + Options::video.shader.enabled = true; + const auto TYPE = (val == "CrtPi") ? Rendering::ShaderType::CRTPI : Rendering::ShaderType::POSTFX; + Options::video.shader.current_shader = TYPE; + auto* screen = Screen::get(); + if (screen != nullptr) { + screen->applySettings(); + } + } + Screen::initShaders(); + }; + options_.push_back(std::make_unique( + Lang::getText("[SERVICE_MENU] SHADER"), + SettingsGroup::VIDEO, + shader_values, + shader_getter, + shader_setter)); +} + +void ServiceMenu::addVideoPresetOption() { + auto preset_getter = []() -> std::string { + if (Options::video.shader.current_shader == Rendering::ShaderType::CRTPI) { + if (Options::crtpi_presets.empty()) { return ""; } + return Options::crtpi_presets.at(static_cast(Options::video.shader.current_crtpi_preset)).name; + } + if (Options::postfx_presets.empty()) { return ""; } + return Options::postfx_presets.at(static_cast(Options::video.shader.current_postfx_preset)).name; + }; + auto preset_adjuster = [](bool up) { + if (Options::video.shader.current_shader == Rendering::ShaderType::CRTPI) { + if (Options::crtpi_presets.empty()) { return; } + const int SIZE = static_cast(Options::crtpi_presets.size()); + Options::video.shader.current_crtpi_preset = up + ? (Options::video.shader.current_crtpi_preset + 1) % SIZE + : (Options::video.shader.current_crtpi_preset + SIZE - 1) % SIZE; + } else { + if (Options::postfx_presets.empty()) { return; } + const int SIZE = static_cast(Options::postfx_presets.size()); + Options::video.shader.current_postfx_preset = up + ? (Options::video.shader.current_postfx_preset + 1) % SIZE + : (Options::video.shader.current_postfx_preset + SIZE - 1) % SIZE; + } + Screen::initShaders(); + }; + auto preset_max_width = [](const Text* text) -> int { + const auto PRESETS_LENGTH = [text](int max_w, const auto& p) { return std::max(max_w, text->length(p.name, -2)); }; + int max_w = std::accumulate(Options::postfx_presets.begin(), Options::postfx_presets.end(), 0, PRESETS_LENGTH); + return std::accumulate(Options::crtpi_presets.begin(), Options::crtpi_presets.end(), max_w, PRESETS_LENGTH); + }; + + options_.push_back(std::make_unique( + Lang::getText("[SERVICE_MENU] SHADER_PRESET"), + SettingsGroup::VIDEO, + preset_getter, + preset_adjuster, + preset_max_width)); +} + +void ServiceMenu::addVideoFilterOption() { + // FILTER: Nearest / Linear (solo visible en el fallback SDL, sin GPU acelerada) + std::vector filter_values = {"Nearest", "Linear"}; + auto filter_getter = []() -> std::string { + return (Options::video.scale_mode == SDL_SCALEMODE_LINEAR) ? "Linear" : "Nearest"; + }; + auto filter_setter = [](const std::string& val) { + Options::video.scale_mode = (val == "Linear") ? SDL_SCALEMODE_LINEAR : SDL_SCALEMODE_NEAREST; + if (Screen::get() != nullptr) { Screen::get()->applyFilter(); } + }; + options_.push_back(std::make_unique( + Lang::getText("[SERVICE_MENU] FILTER"), + SettingsGroup::VIDEO, + filter_values, + filter_getter, + filter_setter)); +} + +void ServiceMenu::addAudioOptions() { options_.push_back(std::make_unique( Lang::getText("[SERVICE_MENU] AUDIO"), SettingsGroup::AUDIO, @@ -500,8 +505,9 @@ void ServiceMenu::initializeOptions() { SettingsGroup::AUDIO, &Options::audio.sound.volume, 5)); +} - // SETTINGS +void ServiceMenu::addSettingsOptions() { options_.push_back(std::make_unique( Lang::getText("[SERVICE_MENU] AUTOFIRE"), SettingsGroup::SETTINGS, @@ -541,8 +547,9 @@ void ServiceMenu::initializeOptions() { Lang::getText("[SERVICE_MENU] ENABLE_SHUTDOWN"), SettingsGroup::SETTINGS, &Options::settings.shutdown_enabled)); +} - // SYSTEM +void ServiceMenu::addSystemOptions() { options_.push_back(std::make_unique( Lang::getText("[SERVICE_MENU] RESET"), SettingsGroup::SYSTEM, @@ -567,8 +574,9 @@ void ServiceMenu::initializeOptions() { Section::options = Section::Options::SHUTDOWN; }, !Options::settings.shutdown_enabled)); +} - // MAIN MENU +void ServiceMenu::addMainMenuOptions() { options_.push_back(std::make_unique( Lang::getText("[SERVICE_MENU] CONTROLS"), SettingsGroup::MAIN, @@ -593,9 +601,6 @@ void ServiceMenu::initializeOptions() { Lang::getText("[SERVICE_MENU] SYSTEM"), SettingsGroup::MAIN, SettingsGroup::SYSTEM)); - - // Oculta opciones según configuración - setHiddenOptions(); } // Sincroniza los valores de las opciones tipo lista diff --git a/source/game/ui/service_menu.hpp b/source/game/ui/service_menu.hpp index 3536e06..8facf81 100644 --- a/source/game/ui/service_menu.hpp +++ b/source/game/ui/service_menu.hpp @@ -5,7 +5,6 @@ #include // Para size_t #include // Para std::uint8_t #include // Para function -#include // Para pair #include // Para unique_ptr #include // Para basic_string, string #include // Para pair @@ -104,6 +103,15 @@ class ServiceMenu { void updateDisplayOptions(); void updateOptionPairs(); void initializeOptions(); + void addControlsOptions(); // CONTROLS: mandos 1/2, teclat, swap + void addVideoOptions(); // VIDEO: orquestra els blocs de vídeo + void addVideoShaderOption(); // VIDEO: tria de shader (Disabled/PostFX/CrtPi) + void addVideoPresetOption(); // VIDEO: cicla presets del shader actiu + void addVideoFilterOption(); // VIDEO: filtre Nearest/Linear (fallback SDL) + void addAudioOptions(); // AUDIO: enabled + tres volums + void addSettingsOptions(); // SETTINGS: autofire, idioma, dificultat, shutdown + void addSystemOptions(); // SYSTEM: reset, quit, shutdown + void addMainMenuOptions(); // MAIN: carpetes de menú void updateMenu(); void applySettings(); void applyControlsSettings(); diff --git a/source/main.cpp b/source/main.cpp index 7d5ff49..4f7ec68 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -12,16 +12,16 @@ Actualizando a la versión "Arcade Edition" en 08/05/2024 #include "core/system/director.hpp" // Para Director -SDL_AppResult SDL_AppInit(void** appstate, int /*argc*/, char** /*argv*/) { +auto SDL_AppInit(void** appstate, int /*argc*/, char** /*argv*/) -> SDL_AppResult { *appstate = new Director(); return SDL_APP_CONTINUE; } -SDL_AppResult SDL_AppIterate(void* appstate) { +auto SDL_AppIterate(void* appstate) -> SDL_AppResult { return static_cast(appstate)->iterate(); } -SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) { +auto SDL_AppEvent(void* appstate, SDL_Event* event) -> SDL_AppResult { return static_cast(appstate)->handleEvent(*event); } diff --git a/source/utils/color.cpp b/source/utils/color.cpp index fee3bbb..4c4c0ba 100644 --- a/source/utils/color.cpp +++ b/source/utils/color.cpp @@ -42,7 +42,7 @@ auto Color::fromHex(const std::string& hex_str) -> Color { } // Implementaciones de métodos estáticos de Color -constexpr auto Color::RGB_TO_HSV(Color color) -> HSV { +constexpr auto Color::rgbToHsv(Color color) -> HSV { float r = color.r / 255.0F; float g = color.g / 255.0F; float b = color.b / 255.0F; @@ -72,7 +72,7 @@ constexpr auto Color::RGB_TO_HSV(Color color) -> HSV { return {.h = h, .s = s, .v = v}; } -constexpr auto Color::HSV_TO_RGB(HSV hsv) -> Color { +constexpr auto Color::hsvToRgb(HSV hsv) -> Color { float c = hsv.v * hsv.s; float x = c * (1 - std::abs(std::fmod(hsv.h / 60.0F, 2) - 1)); float m = hsv.v - c; @@ -132,7 +132,7 @@ namespace Colors { auto generateMirroredCycle(Color base, ColorCycleStyle style) -> Cycle { Cycle result{}; - HSV base_hsv = Color::RGB_TO_HSV(base); + HSV base_hsv = Color::rgbToHsv(base); for (size_t i = 0; i < CYCLE_SIZE; ++i) { float t = static_cast(i) / (CYCLE_SIZE - 1); // 0 → 1 @@ -175,7 +175,7 @@ namespace Colors { .s = fminf(1.0F, fmaxf(0.0F, base_hsv.s + sat_shift)), .v = fminf(1.0F, fmaxf(0.0F, base_hsv.v + val_shift))}; - Color c = Color::HSV_TO_RGB(adjusted); + Color c = Color::hsvToRgb(adjusted); result[i] = c; result[(2 * CYCLE_SIZE) - 1 - i] = c; // espejo } diff --git a/source/utils/color.hpp b/source/utils/color.hpp index f14ea56..f305b70 100644 --- a/source/utils/color.hpp +++ b/source/utils/color.hpp @@ -5,6 +5,7 @@ #include // Para max, min #include // Para array +#include // Para std::uint8_t #include // Para size_t, abs #include // Para string #include // Para vector @@ -48,11 +49,11 @@ struct Color { b(blue), a(alpha) {} - [[nodiscard]] constexpr auto INVERSE() const -> Color { + [[nodiscard]] constexpr auto inverse() const -> Color { return Color(MAX_COLOR_VALUE - r, MAX_COLOR_VALUE - g, MAX_COLOR_VALUE - b, a); } - [[nodiscard]] constexpr auto LIGHTEN(int amount = DEFAULT_LIGHTEN_AMOUNT) const -> Color { + [[nodiscard]] constexpr auto lighten(int amount = DEFAULT_LIGHTEN_AMOUNT) const -> Color { return Color( std::min(static_cast(MAX_COLOR_VALUE), r + amount), std::min(static_cast(MAX_COLOR_VALUE), g + amount), @@ -60,7 +61,7 @@ struct Color { a); } - [[nodiscard]] constexpr auto DARKEN(int amount = DEFAULT_DARKEN_AMOUNT) const -> Color { + [[nodiscard]] constexpr auto darken(int amount = DEFAULT_DARKEN_AMOUNT) const -> Color { return Color( std::max(static_cast(MIN_COLOR_VALUE), r - amount), std::max(static_cast(MIN_COLOR_VALUE), g - amount), @@ -72,14 +73,14 @@ struct Color { static auto fromHex(const std::string& hex_str) -> Color; // Conversiones de formato de color - [[nodiscard]] constexpr static auto RGB_TO_HSV(Color color) -> HSV; - [[nodiscard]] constexpr static auto HSV_TO_RGB(HSV hsv) -> Color; + [[nodiscard]] constexpr static auto rgbToHsv(Color color) -> HSV; + [[nodiscard]] constexpr static auto hsvToRgb(HSV hsv) -> Color; - [[nodiscard]] constexpr auto IS_EQUAL_TO(const Color& other) const -> bool { + [[nodiscard]] constexpr auto isEqualTo(const Color& other) const -> bool { return r == other.r && g == other.g && b == other.b && a == other.a; } - [[nodiscard]] constexpr auto APPROACH_TO(const Color& target, int step = DEFAULT_APPROACH_STEP) const -> Color { + [[nodiscard]] constexpr auto approachTo(const Color& target, int step = DEFAULT_APPROACH_STEP) const -> Color { auto approach_component = [step](Uint8 current, Uint8 target_val) -> Uint8 { if (std::abs(current - target_val) <= step) { return target_val; @@ -96,7 +97,7 @@ struct Color { } // Interpolación lineal hacia otro color (t=0.0: this, t=1.0: target) - [[nodiscard]] constexpr auto LERP(const Color& target, float t) const -> Color { + [[nodiscard]] constexpr auto lerp(const Color& target, float t) const -> Color { // Asegurar que t esté en el rango [0.0, 1.0] t = std::clamp(t, 0.0F, 1.0F); @@ -113,12 +114,12 @@ struct Color { } // Sobrecarga para aceptar componentes RGBA directamente - [[nodiscard]] constexpr auto LERP(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha, float t) const -> Color { - return LERP(Color(red, green, blue, alpha), t); + [[nodiscard]] constexpr auto lerp(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha, float t) const -> Color { + return lerp(Color(red, green, blue, alpha), t); } // Convierte el color a un entero de 32 bits en formato RGBA - [[nodiscard]] constexpr auto TO_UINT32() const -> Uint32 { + [[nodiscard]] constexpr auto toUint32() const -> Uint32 { return (static_cast(r) << 24) | (static_cast(g) << 16) | (static_cast(b) << 8) | @@ -127,7 +128,7 @@ struct Color { }; // --- Enum ColorCycleStyle: define estilos de ciclo de color --- -enum class ColorCycleStyle { +enum class ColorCycleStyle : std::uint8_t { SUBTLE_PULSE, // Variación leve en brillo (por defecto) HUE_WAVE, // Variación suave en tono (sin verde) VIBRANT, // Cambios agresivos en tono y brillo diff --git a/source/utils/param.cpp b/source/utils/param.cpp index a41ab1a..2078dba 100644 --- a/source/utils/param.cpp +++ b/source/utils/param.cpp @@ -9,7 +9,6 @@ #include // Para runtime_error #include // Para string, basic_string, stoi, stof, hash, allocator, operator==, char_traits, operator+, operator>>, getline #include // Para unordered_map, operator==, _Node_iterator_base -#include // Para pair #include "game/ui/notifier.hpp" // Para Notifier #include "utils/color.hpp" // Para Color diff --git a/source/utils/param.hpp b/source/utils/param.hpp index c6fdac8..a3f7d64 100644 --- a/source/utils/param.hpp +++ b/source/utils/param.hpp @@ -167,51 +167,51 @@ struct ParamPlayer { }; // Inicialización con valores por defecto - const Shirt default_player0_shirt = Shirt( + const Shirt DEFAULT_PLAYER0_SHIRT = Shirt( Color::fromHex(Defaults::Player::DefaultShirt::PLAYER0_DARKEST), Color::fromHex(Defaults::Player::DefaultShirt::PLAYER0_DARK), Color::fromHex(Defaults::Player::DefaultShirt::PLAYER0_BASE), Color::fromHex(Defaults::Player::DefaultShirt::PLAYER0_LIGHT)); - const Shirt default_player1_shirt = Shirt( + const Shirt DEFAULT_PLAYER1_SHIRT = Shirt( Color::fromHex(Defaults::Player::DefaultShirt::PLAYER1_DARKEST), Color::fromHex(Defaults::Player::DefaultShirt::PLAYER1_DARK), Color::fromHex(Defaults::Player::DefaultShirt::PLAYER1_BASE), Color::fromHex(Defaults::Player::DefaultShirt::PLAYER1_LIGHT)); - std::array default_shirt = {default_player0_shirt, default_player1_shirt}; + std::array default_shirt = {DEFAULT_PLAYER0_SHIRT, DEFAULT_PLAYER1_SHIRT}; - const Shirt one_coffee_player0_shirt = Shirt( + const Shirt ONE_COFFEE_PLAYER0_SHIRT = Shirt( Color::fromHex(Defaults::Player::OneCoffeeShirt::PLAYER0_DARKEST), Color::fromHex(Defaults::Player::OneCoffeeShirt::PLAYER0_DARK), Color::fromHex(Defaults::Player::OneCoffeeShirt::PLAYER0_BASE), Color::fromHex(Defaults::Player::OneCoffeeShirt::PLAYER0_LIGHT)); - const Shirt one_coffee_player1_shirt = Shirt( + const Shirt ONE_COFFEE_PLAYER1_SHIRT = Shirt( Color::fromHex(Defaults::Player::OneCoffeeShirt::PLAYER1_DARKEST), Color::fromHex(Defaults::Player::OneCoffeeShirt::PLAYER1_DARK), Color::fromHex(Defaults::Player::OneCoffeeShirt::PLAYER1_BASE), Color::fromHex(Defaults::Player::OneCoffeeShirt::PLAYER1_LIGHT)); - std::array one_coffee_shirt = {one_coffee_player0_shirt, one_coffee_player1_shirt}; + std::array one_coffee_shirt = {ONE_COFFEE_PLAYER0_SHIRT, ONE_COFFEE_PLAYER1_SHIRT}; - const Shirt two_coffee_player0_shirt = Shirt( + const Shirt TWO_COFFEE_PLAYER0_SHIRT = Shirt( Color::fromHex(Defaults::Player::TwoCoffeeShirt::PLAYER0_DARKEST), Color::fromHex(Defaults::Player::TwoCoffeeShirt::PLAYER0_DARK), Color::fromHex(Defaults::Player::TwoCoffeeShirt::PLAYER0_BASE), Color::fromHex(Defaults::Player::TwoCoffeeShirt::PLAYER0_LIGHT)); - const Shirt two_coffee_player1_shirt = Shirt( + const Shirt TWO_COFFEE_PLAYER1_SHIRT = Shirt( Color::fromHex(Defaults::Player::TwoCoffeeShirt::PLAYER1_DARKEST), Color::fromHex(Defaults::Player::TwoCoffeeShirt::PLAYER1_DARK), Color::fromHex(Defaults::Player::TwoCoffeeShirt::PLAYER1_BASE), Color::fromHex(Defaults::Player::TwoCoffeeShirt::PLAYER1_LIGHT)); - std::array two_coffee_shirt = {two_coffee_player0_shirt, two_coffee_player1_shirt}; + std::array two_coffee_shirt = {TWO_COFFEE_PLAYER0_SHIRT, TWO_COFFEE_PLAYER1_SHIRT}; - const Color outline_player0_color = Color::fromHex(Defaults::Player::OutlineColor::PLAYER0); - const Color outline_player1_color = Color::fromHex(Defaults::Player::OutlineColor::PLAYER1); - std::array outline_color = {outline_player0_color, outline_player1_color}; + const Color OUTLINE_PLAYER0_COLOR = Color::fromHex(Defaults::Player::OutlineColor::PLAYER0); + const Color OUTLINE_PLAYER1_COLOR = Color::fromHex(Defaults::Player::OutlineColor::PLAYER1); + std::array outline_color = {OUTLINE_PLAYER0_COLOR, OUTLINE_PLAYER1_COLOR}; }; // --- Estructura Param: almacena todos los parámetros del juego --- diff --git a/source/utils/utils.cpp b/source/utils/utils.cpp index 67f780d..d48f412 100644 --- a/source/utils/utils.cpp +++ b/source/utils/utils.cpp @@ -7,7 +7,6 @@ #include // Para clamp, __transform_fn, transform #include // Para tolower, isspace #include // Para pow, sin, M_PI, cos, sqrt -#include // Para operator< #include // Para path #include // Para __find_if_not_fn, find_if_not, reverse_view, __find_fn, find, ref_view #include // Para basic_string, string, allocator, char_traits, operator==, operator+