canvi de pc

This commit is contained in:
2025-07-14 22:27:36 +02:00
parent 5cb67b41d1
commit df53c39200
8 changed files with 56 additions and 21 deletions

View File

@@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -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);
}

View File

@@ -45,7 +45,7 @@ private:
std::vector<std::unique_ptr<PathSprite>> shadow_sprites_; // Vector con los sprites inteligentes para las sombras
std::vector<std::unique_ptr<Writer>> texts_; // Textos de la intro
std::unique_ptr<TiledBG> tiled_bg_; // Fondo en mosaico
//std::unique_ptr<Sprite> shadow_square_for_text_; // Sprite
// std::unique_ptr<Sprite> 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
};

View File

@@ -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);
}
};