diff --git a/data/config/param_320x256.txt b/data/config/param_320x256.txt index a841c74..a2c80ce 100644 --- a/data/config/param_320x256.txt +++ b/data/config/param_320x256.txt @@ -40,7 +40,7 @@ title.press_start_position 180 # Posición Y del texto "Press Start" title.title_duration 800 # Duración de la pantalla de título (frames) title.arcade_edition_position 123 # Posición Y del subtítulo "Arcade Edition" title.title_c_c_position 80 # Posición Y del título principal -title.bg_color 808080 # Color de fondo en la sección titulo +title.bg_color 988db3 # Color de fondo en la sección titulo ## --- BACKGROUND --- background.attenuate_color FFFFFF00 # Color de atenuación del fondo (RGBA hexadecimal) @@ -76,7 +76,7 @@ service_menu.bg_color 000F00F5 # Color de fondo del menú de servicio ( service_menu.drop_shadow false # ¿El menú de servicio tiene sombra? ## --- INTRO --- -intro.bg_color 00FFFF # Color de fondo de la intro +intro.bg_color dbdb82 # Color de fondo de la intro intro.card_color CBDBFC # Color de las tarjetas en la intro intro.shadow_color 00000080 # Color de la sombra de las tarjetas en la intro intro.text_distance_from_bottom 48 # Posicion del texto diff --git a/data/gfx/title/title_arcade_edition.png b/data/gfx/title/title_arcade_edition.png index bbf3d11..eff7668 100644 Binary files a/data/gfx/title/title_arcade_edition.png and b/data/gfx/title/title_arcade_edition.png differ diff --git a/data/gfx/title/title_bg_tile_v2.png b/data/gfx/title/title_bg_tile_v2.png index 885a6b6..8673a2a 100644 Binary files a/data/gfx/title/title_bg_tile_v2.png and b/data/gfx/title/title_bg_tile_v2.png differ diff --git a/data/gfx/title/title_coffee.png b/data/gfx/title/title_coffee.png index 1cc9860..27559b5 100644 Binary files a/data/gfx/title/title_coffee.png and b/data/gfx/title/title_coffee.png differ diff --git a/data/gfx/title/title_crisis.png b/data/gfx/title/title_crisis.png index e983532..cf80b55 100644 Binary files a/data/gfx/title/title_crisis.png and b/data/gfx/title/title_crisis.png differ diff --git a/source/sections/intro.cpp b/source/sections/intro.cpp index 2bf286e..85026c7 100644 --- a/source/sections/intro.cpp +++ b/source/sections/intro.cpp @@ -49,6 +49,46 @@ void Intro::checkEvents() SDL_Event event; while (SDL_PollEvent(&event)) { + if (event.type == SDL_EVENT_KEY_DOWN && event.key.repeat == 1) + { + static Color color = Color(128, 128, 128); + switch (event.key.key) + { + case SDLK_A: + ++color.r; + if (color.r > 255) + color.r = 0; + break; + + case SDLK_Z: + --color.r; + if (color.r < 0) + color.r =255; + break; + + case SDLK_S: + ++color.g; + break; + + case SDLK_X: + --color.g; + break; + + case SDLK_D: + ++color.b; + break; + + case SDLK_C: + --color.b; + break; + + default: + break; + } + tiled_bg_->setColor(color); + std::cout << (int)color.r << "," << (int)color.g << "," << (int)color.b << std::endl; + } + GlobalEvents::check(event); } } @@ -271,11 +311,8 @@ void Intro::render() { case IntroState::SCENES: { + renderTextRect(); renderSprites(); - static const float HEIGHT = Resource::get()->getText("04b_25_metal")->getCharacterSize(); - static SDL_FRect rect = {0.0f, param.game.height - param.intro.text_distance_from_bottom - HEIGHT, param.game.width, HEIGHT * 3}; - SDL_SetRenderDrawColor(Screen::get()->getRenderer(), param.intro.shadow_color.r, param.intro.shadow_color.g, param.intro.shadow_color.b, param.intro.shadow_color.a); - SDL_RenderFillRect(Screen::get()->getRenderer(), &rect); renderTexts(); break; } @@ -538,18 +575,6 @@ void Intro::updatePostState() { tiled_bg_->stopGracefully(); - /* - // Modifica el color del fondo hasta llegar a blanco - if (bg_color_.r <= 253 || bg_color_.g <= 253 || bg_color_.b <= 253) // Garantiza que no se exceda de 255 al incrementar de 2 en 2 - { - bg_color_ = bg_color_.lighten(2); - } - else - { - bg_color_ = Color(255, 255, 255); // Asegura que bg_color_ no exceda el límite máximo - } - */ - if (bg_color_.isEqualTo(param.title.bg_color)) { // Ya hemos llegado al color objetivo @@ -563,7 +588,7 @@ void Intro::updatePostState() } // Cambia de estado si el fondo se ha detenido y recuperado el color - if (tiled_bg_->isStopped() && bg_color_.r == 255 && bg_color_.g == 255 && bg_color_.b == 255) + if (tiled_bg_->isStopped() && bg_color_.isEqualTo(param.title.bg_color)) { post_state_ = IntroPostState::END; state_start_time_ = SDL_GetTicks(); @@ -584,3 +609,11 @@ void Intro::updatePostState() break; } } + +void Intro::renderTextRect() +{ + static const float HEIGHT = Resource::get()->getText("04b_25_metal")->getCharacterSize(); + static SDL_FRect rect = {0.0f, param.game.height - param.intro.text_distance_from_bottom - HEIGHT, param.game.width, HEIGHT * 3}; + SDL_SetRenderDrawColor(Screen::get()->getRenderer(), param.intro.shadow_color.r, param.intro.shadow_color.g, param.intro.shadow_color.b, param.intro.shadow_color.a); + SDL_RenderFillRect(Screen::get()->getRenderer(), &rect); +} \ No newline at end of file diff --git a/source/sections/intro.h b/source/sections/intro.h index f9aaf63..35db874 100644 --- a/source/sections/intro.h +++ b/source/sections/intro.h @@ -45,7 +45,7 @@ private: std::vector> shadow_sprites_; // Vector con los sprites inteligentes para las sombras std::vector> texts_; // Textos de la intro std::unique_ptr tiled_bg_; // Fondo en mosaico - //std::unique_ptr shadow_square_for_text_; // Sprite + // std::unique_ptr shadow_square_for_text_; // Sprite // --- Variables --- Uint64 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa @@ -67,5 +67,6 @@ private: void updateTexts(); // Actualiza los textos void renderSprites(); // Dibuja los sprites void renderTexts(); // Dibuja los textos + void renderTextRect(); // Dibuja el rectangulo de fondo del texto; void updatePostState(); // Actualiza el estado POST }; diff --git a/source/utils.h b/source/utils.h index f755cb7..c5e1a06 100644 --- a/source/utils.h +++ b/source/utils.h @@ -111,8 +111,9 @@ struct Color Uint8 newR = (std::abs(r - target.r) <= step) ? target.r : (r < target.r ? r + step : r - step); Uint8 newG = (std::abs(g - target.g) <= step) ? target.g : (g < target.g ? g + step : g - step); Uint8 newB = (std::abs(b - target.b) <= step) ? target.b : (b < target.b ? b + step : b - step); + Uint8 newA = (std::abs(a - target.a) <= step) ? target.a : (a < target.a ? a + step : a - step); - return Color(newR, newG, newB, a); + return Color(newR, newG, newB, newA); } };