afegits estats al LOGO

This commit is contained in:
2025-11-28 23:06:25 +01:00
parent 4f926ddebf
commit 656144d182
2 changed files with 77 additions and 24 deletions

View File

@@ -17,8 +17,16 @@ public:
void executar(); // Bucle principal de l'escena
private:
// Màquina d'estats per l'animació
enum class EstatAnimacio {
PRE_ANIMATION, // Pantalla negra inicial
ANIMATION, // Animació de zoom de lletres
POST_ANIMATION // Logo complet visible
};
SDLManager& sdl_;
float temps_acumulat_;
EstatAnimacio estat_actual_; // Estat actual de la màquina
float temps_estat_actual_; // Temps en l'estat actual (reset en cada transició)
// Estructura per a cada lletra del logo
struct LetraLogo {
@@ -31,15 +39,25 @@ private:
std::vector<LetraLogo> lletres_; // 9 lletres: J-A-I-L-G-A-M-E-S
// Constants d'animació
static constexpr float DURACIO_ZOOM = 4.0f; // Duració del zoom (segons)
static constexpr float DURACIO_TOTAL = 20.0f; // Duració total abans d'anar al joc
static constexpr float ESCALA_INICIAL = 0.1f; // Escala inicial (10%)
static constexpr float ESCALA_FINAL = 0.8f; // Escala final (100%)
static constexpr float ESPAI_ENTRE_LLETRES = 10.0f; // Espaiat entre lletres
static constexpr float DURACIO_PRE = 1.5f; // Duració PRE_ANIMATION (pantalla negra)
static constexpr float DURACIO_ZOOM = 4.0f; // Duració del zoom (segons)
static constexpr float DURACIO_POST = 4.0f; // Duració POST_ANIMATION (logo complet)
static constexpr float ESCALA_INICIAL = 0.1f; // Escala inicial (10%)
static constexpr float ESCALA_FINAL = 0.8f; // Escala final (80%)
static constexpr float ESPAI_ENTRE_LLETRES = 10.0f; // Espaiat entre lletres
// Constants d'animació seqüencial
static constexpr float THRESHOLD_LETRA = 0.6f; // Umbral per activar següent lletra (0.0-1.0)
static constexpr float ORIGEN_ZOOM_X = 640.0f / 2.0f; // Punt inicial X del zoom (320)
static constexpr float ORIGEN_ZOOM_Y = 480.0f * 0.4f; // Punt inicial Y del zoom (240)
// Mètodes privats
void inicialitzar_lletres();
void actualitzar(float delta_time);
void dibuixar();
void processar_events(const SDL_Event& event);
// Mètodes de gestió d'estats
void canviar_estat(EstatAnimacio nou_estat);
bool totes_lletres_completes() const;
};