diff --git a/data/config/param_320x240.txt b/data/config/param_320x240.txt index 1a14a67..438ad00 100644 --- a/data/config/param_320x240.txt +++ b/data/config/param_320x240.txt @@ -107,4 +107,29 @@ resource.color FFFFFF # Color de recurso 2 # --- TABE --- tabe.min_spawn_time 2.0f # Tiempo mínimo en minutos para que aparezca el Tabe -tabe.max_spawn_time 3.0f # Tiempo máximo en minutos para que aparezca el Tabe \ No newline at end of file +tabe.max_spawn_time 3.0f # Tiempo máximo en minutos para que aparezca el Tabe + +# --- PLAYER --- +# Jugador 1 - Camiseta con 1 café +player.one_coffee_shirt[0].darkest 3D9C70FF # Tono más oscuro - bordes y contornos (Jugador 1, 1 café) +player.one_coffee_shirt[0].dark 4FA370FF # Tono oscuro - sombras (Jugador 1, 1 café) +player.one_coffee_shirt[0].base 5DDE70FF # Tono principal - color base (Jugador 1, 1 café) +player.one_coffee_shirt[0].light 7DF25CFF # Tono claro - zonas iluminadas (Jugador 1, 1 café) + +# Jugador 1 - Camiseta con 2 cafés +player.two_coffee_shirt[0].darkest D6A41AFF # Tono más oscuro - bordes y contornos (Jugador 1, 2 cafés) +player.two_coffee_shirt[0].dark E3AE1BFF # Tono oscuro - sombras (Jugador 1, 2 cafés) +player.two_coffee_shirt[0].base EFB71DFF # Tono principal - color base (Jugador 1, 2 cafés) +player.two_coffee_shirt[0].light FCC11EFF # Tono claro - zonas iluminadas (Jugador 1, 2 cafés) + +# Jugador 2 - Camiseta con 1 café +player.one_coffee_shirt[1].darkest 2E8B57FF # Tono más oscuro - bordes y contornos (Jugador 2, 1 café) +player.one_coffee_shirt[1].dark 3CB371FF # Tono oscuro - sombras (Jugador 2, 1 café) +player.one_coffee_shirt[1].base 48D181FF # Tono principal - color base (Jugador 2, 1 café) +player.one_coffee_shirt[1].light 55EF8DFF # Tono claro - zonas iluminadas (Jugador 2, 1 café) + +# Jugador 2 - Camiseta con 2 cafés +player.two_coffee_shirt[1].darkest E08500FF # Tono más oscuro - bordes y contornos (Jugador 2, 2 cafés) +player.two_coffee_shirt[1].dark FA7D00FF # Tono oscuro - sombras (Jugador 2, 2 cafés) +player.two_coffee_shirt[1].base FAA200FF # Tono principal - color base (Jugador 2, 2 cafés) +player.two_coffee_shirt[1].light FA8500FF # Tono claro - zonas iluminadas (Jugador 2, 2 cafés) \ No newline at end of file diff --git a/data/config/param_320x256.txt b/data/config/param_320x256.txt index e0d21e1..5b3d6c9 100644 --- a/data/config/param_320x256.txt +++ b/data/config/param_320x256.txt @@ -106,4 +106,29 @@ resource.color FFFFFF # Color de recursos # --- TABE --- tabe.min_spawn_time 2.0f # Tiempo mínimo en segundos para que aparezca el Tabe -tabe.max_spawn_time 3.0f # Tiempo máximo en segundos para que aparezca el Tabe \ No newline at end of file +tabe.max_spawn_time 3.0f # Tiempo máximo en segundos para que aparezca el Tabe + +# --- PLAYER --- +# Jugador 1 - Camiseta con 1 café +player.one_coffee_shirt[0].darkest 3D9C70FF # Tono más oscuro - bordes y contornos (Jugador 1, 1 café) +player.one_coffee_shirt[0].dark 4FA370FF # Tono oscuro - sombras (Jugador 1, 1 café) +player.one_coffee_shirt[0].base 5DDE70FF # Tono principal - color base (Jugador 1, 1 café) +player.one_coffee_shirt[0].light 7DF25CFF # Tono claro - zonas iluminadas (Jugador 1, 1 café) + +# Jugador 1 - Camiseta con 2 cafés +player.two_coffee_shirt[0].darkest D6A41AFF # Tono más oscuro - bordes y contornos (Jugador 1, 2 cafés) +player.two_coffee_shirt[0].dark E3AE1BFF # Tono oscuro - sombras (Jugador 1, 2 cafés) +player.two_coffee_shirt[0].base EFB71DFF # Tono principal - color base (Jugador 1, 2 cafés) +player.two_coffee_shirt[0].light FCC11EFF # Tono claro - zonas iluminadas (Jugador 1, 2 cafés) + +# Jugador 2 - Camiseta con 1 café +player.one_coffee_shirt[1].darkest 2E8B57FF # Tono más oscuro - bordes y contornos (Jugador 2, 1 café) +player.one_coffee_shirt[1].dark 3CB371FF # Tono oscuro - sombras (Jugador 2, 1 café) +player.one_coffee_shirt[1].base 48D181FF # Tono principal - color base (Jugador 2, 1 café) +player.one_coffee_shirt[1].light 55EF8DFF # Tono claro - zonas iluminadas (Jugador 2, 1 café) + +# Jugador 2 - Camiseta con 2 cafés +player.two_coffee_shirt[1].darkest E08500FF # Tono más oscuro - bordes y contornos (Jugador 2, 2 cafés) +player.two_coffee_shirt[1].dark FA7D00FF # Tono oscuro - sombras (Jugador 2, 2 cafés) +player.two_coffee_shirt[1].base FAA200FF # Tono principal - color base (Jugador 2, 2 cafés) +player.two_coffee_shirt[1].light FA8500FF # Tono claro - zonas iluminadas (Jugador 2, 2 cafés) \ No newline at end of file diff --git a/source/color.h b/source/color.h index d04998b..9ff9eda 100644 --- a/source/color.h +++ b/source/color.h @@ -81,6 +81,14 @@ struct Color { return Color(new_r, new_g, new_b, new_a); } + + // Convierte el color a un entero de 32 bits en formato RGBA + [[nodiscard]] constexpr auto toUint32() const -> Uint32 { + return (static_cast(r) << 24) | + (static_cast(g) << 16) | + (static_cast(b) << 8) | + static_cast(a); + } }; // Estructura para definir un color HSV diff --git a/source/defaults.h b/source/defaults.h index 71b4ae5..a33c5f2 100644 --- a/source/defaults.h +++ b/source/defaults.h @@ -3,7 +3,7 @@ #include #include "color.h" -#include "ui/notifier.h" +#include "ui/notifier.h" // Para Notifier::Position // Configuración centralizada con todos los valores por defecto del juego namespace GameDefaults { @@ -146,4 +146,35 @@ namespace Tabe { constexpr float MIN_SPAWN_TIME = 2.0f; constexpr float MAX_SPAWN_TIME = 3.0f; } // namespace Tabe + +// --- PLAYER --- +namespace Player { +namespace OneCoffeeShirt { +// Player 0 (Jugador 1) +constexpr const char* PLAYER0_DARKEST = "3D9C70FF"; // 61, 156, 112, 255 +constexpr const char* PLAYER0_DARK = "4FA370FF"; // 79, 163, 112, 255 +constexpr const char* PLAYER0_BASE = "5DDE70FF"; // 93, 222, 112, 255 +constexpr const char* PLAYER0_LIGHT = "7DF25CFF"; // 125, 242, 92, 255 + +// Player 1 (Jugador 2) +constexpr const char* PLAYER1_DARKEST = "2E8B57FF"; // 46, 139, 87, 255 +constexpr const char* PLAYER1_DARK = "3CB371FF"; // 60, 179, 113, 255 +constexpr const char* PLAYER1_BASE = "48D181FF"; // 72, 209, 129, 255 +constexpr const char* PLAYER1_LIGHT = "55EF8DFF"; // 85, 239, 141, 255 +} // namespace OneCoffeeShirt + +namespace TwoCoffeeShirt { +// Player 0 (Jugador 1) +constexpr const char* PLAYER0_DARKEST = "D6A41AFF"; // 214, 164, 26, 255 +constexpr const char* PLAYER0_DARK = "E3AE1BFF"; // 227, 174, 27, 255 +constexpr const char* PLAYER0_BASE = "EFB71DFF"; // 239, 183, 29, 255 +constexpr const char* PLAYER0_LIGHT = "FCC11EFF"; // 252, 193, 30, 255 + +// Player 1 (Jugador 2) +constexpr const char* PLAYER1_DARKEST = "E08500FF"; // 224, 133, 0, 255 +constexpr const char* PLAYER1_DARK = "FA7D00FF"; // 250, 125, 0, 255 +constexpr const char* PLAYER1_BASE = "FAA200FF"; // 250, 162, 0, 255 +constexpr const char* PLAYER1_LIGHT = "FA8500FF"; // 250, 133, 0, 255 +} // namespace TwoCoffeeShirt +} // namespace Player } // namespace GameDefaults \ No newline at end of file diff --git a/source/param.cpp b/source/param.cpp index c22119b..b6f146e 100644 --- a/source/param.cpp +++ b/source/param.cpp @@ -11,7 +11,7 @@ #include "color.h" #include "utils.h" -#include "ui/notifier.h" +#include "ui/notifier.h" // Para Notifier::Position // Variable global - ahora se inicializa automáticamente con valores por defecto Param param; @@ -136,7 +136,23 @@ namespace { {"intro.card_color", [](const std::string& v) { param.intro.card_color = Color::fromHex(v); }}, {"intro.shadow_color", [](const std::string& v) { param.intro.shadow_color = Color::fromHex(v); }}, {"debug.color", [](const std::string& v) { param.debug.color = Color::fromHex(v); }}, - {"resource.color", [](const std::string& v) { param.resource.color = Color::fromHex(v); }} + {"resource.color", [](const std::string& v) { param.resource.color = Color::fromHex(v); }}, + {"player.one_coffee_shirt[0].darkest", [](const std::string& v) { param.player.one_coffee_shirt[0].darkest = Color::fromHex(v); }}, + {"player.one_coffee_shirt[0].dark", [](const std::string& v) { param.player.one_coffee_shirt[0].dark = Color::fromHex(v); }}, + {"player.one_coffee_shirt[0].base", [](const std::string& v) { param.player.one_coffee_shirt[0].base = Color::fromHex(v); }}, + {"player.one_coffee_shirt[0].light", [](const std::string& v) { param.player.one_coffee_shirt[0].light = Color::fromHex(v); }}, + {"player.one_coffee_shirt[1].darkest", [](const std::string& v) { param.player.one_coffee_shirt[1].darkest = Color::fromHex(v); }}, + {"player.one_coffee_shirt[1].dark", [](const std::string& v) { param.player.one_coffee_shirt[1].dark = Color::fromHex(v); }}, + {"player.one_coffee_shirt[1].base", [](const std::string& v) { param.player.one_coffee_shirt[1].base = Color::fromHex(v); }}, + {"player.one_coffee_shirt[1].light", [](const std::string& v) { param.player.one_coffee_shirt[1].light = Color::fromHex(v); }}, + {"player.two_coffee_shirt[0].darkest", [](const std::string& v) { param.player.two_coffee_shirt[0].darkest = Color::fromHex(v); }}, + {"player.two_coffee_shirt[0].dark", [](const std::string& v) { param.player.two_coffee_shirt[0].dark = Color::fromHex(v); }}, + {"player.two_coffee_shirt[0].base", [](const std::string& v) { param.player.two_coffee_shirt[0].base = Color::fromHex(v); }}, + {"player.two_coffee_shirt[0].light", [](const std::string& v) { param.player.two_coffee_shirt[0].light = Color::fromHex(v); }}, + {"player.two_coffee_shirt[1].darkest", [](const std::string& v) { param.player.two_coffee_shirt[1].darkest = Color::fromHex(v); }}, + {"player.two_coffee_shirt[1].dark", [](const std::string& v) { param.player.two_coffee_shirt[1].dark = Color::fromHex(v); }}, + {"player.two_coffee_shirt[1].base", [](const std::string& v) { param.player.two_coffee_shirt[1].base = Color::fromHex(v); }}, + {"player.two_coffee_shirt[1].light", [](const std::string& v) { param.player.two_coffee_shirt[1].light = Color::fromHex(v); }} }; static const std::unordered_map> BOOL_PARAMS = { diff --git a/source/param.h b/source/param.h index bbce614..76725c8 100644 --- a/source/param.h +++ b/source/param.h @@ -5,10 +5,10 @@ #include // Para array #include // Para basic_string, string -#include "color.h" // Para Color +#include "color.h" // Para Color, Zone #include "defaults.h" // Para los valores por defecto -#include "ui/notifier.h" // Para Notifier -#include "utils.h" // Para zone +#include "ui/notifier.h" // Para Notifier::Position +#include "utils.h" // --- Parámetros del juego --- struct ParamGame { @@ -150,6 +150,43 @@ struct ParamTabe { float max_spawn_time = GameDefaults::Tabe::MAX_SPAWN_TIME; }; +// --- Parámetros del Jugador --- +struct ParamPlayer { + // Configuración de camisetas del jugador + struct Shirt { + Color darkest; // Tono más oscuro - bordes y contornos + Color dark; // Tono oscuro - sombras + Color base; // Tono principal - color base de la camiseta + Color light; // Tono claro - zonas iluminadas/highlights + + // Constructor por defecto + Shirt() = default; + + // Constructor con tonalidades específicas + Shirt(const Color& darkest_tone, const Color& dark_tone, const Color& base_tone, const Color& light_tone) + : darkest(darkest_tone), dark(dark_tone), base(base_tone), light(light_tone) {} + }; + + // Inicialización con valores por defecto + std::array one_coffee_shirt = {{Shirt(Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER0_DARKEST), + Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER0_DARK), + Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER0_BASE), + Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER0_LIGHT)), + Shirt(Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER1_DARKEST), + Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER1_DARK), + Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER1_BASE), + Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER1_LIGHT))}}; + + std::array two_coffee_shirt = {{Shirt(Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER0_DARKEST), + Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER0_DARK), + Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER0_BASE), + Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER0_LIGHT)), + Shirt(Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER1_DARKEST), + Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER1_DARK), + Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER1_BASE), + Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER1_LIGHT))}}; +}; + // --- Estructura principal para almacenar todos los parámetros del juego --- struct Param { ParamGame game; @@ -164,6 +201,7 @@ struct Param { ParamDebug debug; ParamResource resource; ParamTabe tabe; + ParamPlayer player; // Constructor que inicializa las zonas que dependen de otros valores Param() { diff --git a/source/resource.cpp b/source/resource.cpp index efa4a20..3e1e3b1 100644 --- a/source/resource.cpp +++ b/source/resource.cpp @@ -531,16 +531,19 @@ void Resource::createPlayerTextures() { // Configuración de jugadores y sus paletas struct PlayerConfig { - std::string base_texture; - std::vector palette_files; - std::string name_prefix; + std::string base_texture; + std::vector palette_files; + std::string name_prefix; }; std::vector players = { {"player1.gif", {"player1_coffee1.pal", "player1_coffee2.pal", "player1_invencible.pal"}, "player1"}, {"player2.gif", {"player2_coffee1.pal", "player2_coffee2.pal", "player2_invencible.pal"}, "player2"}}; - for (const auto &player : players) { + // Bucle principal modificado para usar un índice (player_idx) + for (size_t player_idx = 0; player_idx < players.size(); ++player_idx) { + const auto &player = players[player_idx]; // Obtenemos el jugador actual + // Encontrar el archivo original de la textura std::string texture_file_path; auto texture_list = Asset::get()->getListByType(Asset::Type::BITMAP); @@ -567,6 +570,17 @@ void Resource::createPlayerTextures() { texture_copy->addPaletteFromPalFile(Asset::get()->get(player.palette_files[1])); texture_copy->addPaletteFromPalFile(Asset::get()->get(player.palette_files[2])); + // Añade los colores establecidos en param.player usando el índice del jugador (player_idx) + texture_copy->setPaletteColor(1, 16, param.player.one_coffee_shirt[player_idx].darkest.toUint32()); + texture_copy->setPaletteColor(1, 17, param.player.one_coffee_shirt[player_idx].dark.toUint32()); + texture_copy->setPaletteColor(1, 18, param.player.one_coffee_shirt[player_idx].base.toUint32()); + texture_copy->setPaletteColor(1, 19, param.player.one_coffee_shirt[player_idx].light.toUint32()); + + texture_copy->setPaletteColor(2, 16, param.player.two_coffee_shirt[player_idx].darkest.toUint32()); + texture_copy->setPaletteColor(2, 17, param.player.two_coffee_shirt[player_idx].dark.toUint32()); + texture_copy->setPaletteColor(2, 18, param.player.two_coffee_shirt[player_idx].base.toUint32()); + texture_copy->setPaletteColor(2, 19, param.player.two_coffee_shirt[player_idx].light.toUint32()); + // Cambiar a la paleta específica (índice i+1 porque 0 es la original) texture_copy->setPalette(i + 1); diff --git a/source/ui/menu_renderer.h b/source/ui/menu_renderer.h index bb53019..549cdd3 100644 --- a/source/ui/menu_renderer.h +++ b/source/ui/menu_renderer.h @@ -75,7 +75,7 @@ class MenuRenderer { size_t max_menu_width_ = 0; size_t max_menu_height_ = 0; - // --- Estructuras de Animación (inspirado en WindowMessage) --- + // --- Estructuras de Animación --- struct ResizeAnimation { bool active = false; float start_width, start_height; diff --git a/source/ui/window_message.h b/source/ui/window_message.h index c9588df..dc10712 100644 --- a/source/ui/window_message.h +++ b/source/ui/window_message.h @@ -59,8 +59,10 @@ class WindowMessage { line_spacing(param_config.line_spacing), title_separator_spacing(param_config.title_separator_spacing), min_width(param_config.min_width), - text_safety_margin(param_config.text_safety_margin), min_height(param_config.min_height), + max_width_ratio(param_config.max_width_ratio), + max_height_ratio(param_config.max_height_ratio), + text_safety_margin(param_config.text_safety_margin), animation_duration(param_config.animation_duration) {} };