new: es pot definir el color de fonfo del titol
fix: el color de fondo de la intro ara ja canvia be cap al color de fondo del titol (abans soles sabia canviar cap al blanc)
This commit is contained in:
@@ -40,6 +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.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.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.title_c_c_position 80 # Posición Y del título principal
|
||||||
|
title.bg_color FF0000 # Color de fondo en la sección titulo
|
||||||
|
|
||||||
## --- BACKGROUND ---
|
## --- BACKGROUND ---
|
||||||
background.attenuate_color FFFFFF00 # Color de atenuación del fondo (RGBA hexadecimal)
|
background.attenuate_color FFFFFF00 # Color de atenuación del fondo (RGBA hexadecimal)
|
||||||
@@ -76,6 +77,7 @@ service_menu.drop_shadow false # ¿El menú de servicio tiene sombra?
|
|||||||
|
|
||||||
## --- INTRO ---
|
## --- INTRO ---
|
||||||
intro.bg_color 543149 # Color de fondo de la intro
|
intro.bg_color 543149 # Color de fondo de la intro
|
||||||
|
intro.bg_color 00FFFF # Color de fondo de la intro
|
||||||
intro.card_color CBDBFC # Color de las tarjetas en la intro
|
intro.card_color CBDBFC # Color de las tarjetas en la intro
|
||||||
|
|
||||||
## --- DEBUG ---
|
## --- DEBUG ---
|
||||||
|
|||||||
BIN
data/gfx/title/title_bg_tile_v2.png
Normal file
BIN
data/gfx/title/title_bg_tile_v2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -49,7 +49,7 @@ Director::Director(int argc, const char *argv[])
|
|||||||
Section::name = Section::Name::GAME;
|
Section::name = Section::Name::GAME;
|
||||||
Section::options = Section::Options::GAME_PLAY_1P;
|
Section::options = Section::Options::GAME_PLAY_1P;
|
||||||
#elif DEBUG
|
#elif DEBUG
|
||||||
Section::name = Section::Name::TITLE;
|
Section::name = Section::Name::INTRO;
|
||||||
Section::options = Section::Options::GAME_PLAY_1P;
|
Section::options = Section::Options::GAME_PLAY_1P;
|
||||||
#else // NORMAL GAME
|
#else // NORMAL GAME
|
||||||
Section::name = Section::Name::LOGO;
|
Section::name = Section::Name::LOGO;
|
||||||
@@ -402,6 +402,7 @@ void Director::setFileList()
|
|||||||
|
|
||||||
// Texturas - Titulo
|
// Texturas - Titulo
|
||||||
Asset::get()->add(prefix + "/data/gfx/title/title_bg_tile.png", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/gfx/title/title_bg_tile.png", AssetType::BITMAP);
|
||||||
|
Asset::get()->add(prefix + "/data/gfx/title/title_bg_tile_v2.png", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/gfx/title/title_coffee.png", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/gfx/title/title_coffee.png", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/gfx/title/title_crisis.png", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/gfx/title/title_crisis.png", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/gfx/title/title_arcade_edition.png", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/gfx/title/title_arcade_edition.png", AssetType::BITMAP);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ void initParam()
|
|||||||
param.title.title_duration = 800;
|
param.title.title_duration = 800;
|
||||||
param.title.arcade_edition_position = 123;
|
param.title.arcade_edition_position = 123;
|
||||||
param.title.title_c_c_position = 11;
|
param.title.title_c_c_position = 11;
|
||||||
|
param.title.bg_color = Color(255, 255, 255);
|
||||||
|
|
||||||
// BACKGROUND
|
// BACKGROUND
|
||||||
param.background.attenuate_color = Color(255, 255, 255, 0);
|
param.background.attenuate_color = Color(255, 255, 255, 0);
|
||||||
@@ -308,6 +309,11 @@ bool setParams(const std::string &var, const std::string &value)
|
|||||||
param.title.title_c_c_position = std::stoi(value);
|
param.title.title_c_c_position = std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (var == "title.bg_color")
|
||||||
|
{
|
||||||
|
param.title.bg_color = Color::fromHex(value);
|
||||||
|
}
|
||||||
|
|
||||||
// BACKGROUND
|
// BACKGROUND
|
||||||
else if (var == "background.attenuate_color")
|
else if (var == "background.attenuate_color")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ struct ParamTitle
|
|||||||
int title_duration; // Tiempo de inactividad del título
|
int title_duration; // Tiempo de inactividad del título
|
||||||
int arcade_edition_position; // Posición del bitmap "Arcade Edition"
|
int arcade_edition_position; // Posición del bitmap "Arcade Edition"
|
||||||
int title_c_c_position; // Posición del bitmap "Coffee Crisis"
|
int title_c_c_position; // Posición del bitmap "Coffee Crisis"
|
||||||
|
Color bg_color; // Color para los tiles de fondo
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- Parámetros del fondo ---
|
// --- Parámetros del fondo ---
|
||||||
|
|||||||
@@ -500,6 +500,7 @@ void Intro::updatePostState()
|
|||||||
{
|
{
|
||||||
tiled_bg_->stopGracefully();
|
tiled_bg_->stopGracefully();
|
||||||
|
|
||||||
|
/*
|
||||||
// Modifica el color del fondo hasta llegar a blanco
|
// 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
|
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
|
||||||
{
|
{
|
||||||
@@ -509,6 +510,17 @@ void Intro::updatePostState()
|
|||||||
{
|
{
|
||||||
bg_color_ = Color(255, 255, 255); // Asegura que bg_color_ no exceda el límite máximo
|
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
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bg_color_ = bg_color_.approachTo(param.title.bg_color, 2);
|
||||||
|
}
|
||||||
|
|
||||||
tiled_bg_->setColor(bg_color_);
|
tiled_bg_->setColor(bg_color_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ Title::Title()
|
|||||||
state_(TitleState::LOGO_ANIMATING)
|
state_(TitleState::LOGO_ANIMATING)
|
||||||
{
|
{
|
||||||
// Configura objetos
|
// Configura objetos
|
||||||
|
tiled_bg_->setColor(param.title.bg_color);
|
||||||
game_logo_->enable();
|
game_logo_->enable();
|
||||||
mini_logo_sprite_->setX(param.game.game_area.center_x - mini_logo_sprite_->getWidth() / 2);
|
mini_logo_sprite_->setX(param.game.game_area.center_x - mini_logo_sprite_->getWidth() / 2);
|
||||||
fade_->setColor(param.fade.color);
|
fade_->setColor(param.fade.color);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ TiledBG::~TiledBG()
|
|||||||
void TiledBG::fillTexture()
|
void TiledBG::fillTexture()
|
||||||
{
|
{
|
||||||
// Crea los objetos para pintar en la textura de fondo
|
// Crea los objetos para pintar en la textura de fondo
|
||||||
auto tile = std::make_unique<Sprite>(Resource::get()->getTexture("title_bg_tile.png"), (SDL_FRect){0, 0, TILE_WIDTH_, TILE_HEIGHT_});
|
auto tile = std::make_unique<Sprite>(Resource::get()->getTexture("title_bg_tile_v2.png"), (SDL_FRect){0, 0, TILE_WIDTH_, TILE_HEIGHT_});
|
||||||
|
|
||||||
// Prepara para dibujar sobre la textura
|
// Prepara para dibujar sobre la textura
|
||||||
auto temp = SDL_GetRenderTarget(renderer_);
|
auto temp = SDL_GetRenderTarget(renderer_);
|
||||||
|
|||||||
@@ -100,6 +100,20 @@ struct Color
|
|||||||
|
|
||||||
return Color(r, g, b, a);
|
return Color(r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr bool isEqualTo(const Color &other) const
|
||||||
|
{
|
||||||
|
return r == other.r && g == other.g && b == other.b && a == other.a;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr Color approachTo(const Color &target, int step = 1) const
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
return Color(newR, newG, newB, a);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Estructura para definir un color HSV
|
// Estructura para definir un color HSV
|
||||||
|
|||||||
Reference in New Issue
Block a user