treballant en la intro

This commit is contained in:
2025-07-14 19:43:07 +02:00
parent bfd3943bba
commit 5cb67b41d1
6 changed files with 24 additions and 9 deletions

View File

@@ -83,6 +83,7 @@ void initParam()
param.intro.bg_color = Color::fromHex("543149");
param.intro.card_color = Color::fromHex("CBDBFC");
param.intro.shadow_color = Color::fromHex("00000080");
param.intro.text_distance_from_bottom = 48;
}
// Carga los parámetros desde un archivo
@@ -465,6 +466,11 @@ bool setParams(const std::string &var, const std::string &value)
param.intro.shadow_color = Color::fromHex(value);
}
else if (var == "intro.text_distance_from_bottom")
{
param.intro.text_distance_from_bottom = std::stoi(value);
}
// DEBUG
else if (var == "debug.color")
{

View File

@@ -107,6 +107,7 @@ struct ParamIntro
Color bg_color;
Color card_color;
Color shadow_color;
int text_distance_from_bottom;
};
// --- Parámetros para Debug ---

View File

@@ -272,6 +272,10 @@ void Intro::render()
case IntroState::SCENES:
{
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;
}
@@ -432,8 +436,8 @@ void Intro::initTexts()
for (int i = 0; i < TOTAL_TEXTS; ++i)
{
auto w = std::make_unique<Writer>(Resource::get()->getText("04b_25_metal"));
w->setPosX(BLOCK * 0);
w->setPosY(param.game.height - (BLOCK * 6));
w->setPosX(0);
w->setPosY(param.game.height - param.intro.text_distance_from_bottom);
w->setKerning(-2);
w->setEnabled(false);
w->setFinishedCounter(180);

View File

@@ -45,6 +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
// --- Variables ---
Uint64 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa