46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
// escena_logo.hpp - Pantalla d'inici del joc
|
|
// Mostra logo JAILGAMES animat amb zoom i salta al joc
|
|
// © 2025 Port a C++20
|
|
|
|
#pragma once
|
|
|
|
#include "../../core/rendering/sdl_manager.hpp"
|
|
#include "../../core/graphics/shape.hpp"
|
|
#include "../../core/types.hpp"
|
|
#include <SDL3/SDL.h>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
class EscenaLogo {
|
|
public:
|
|
explicit EscenaLogo(SDLManager& sdl);
|
|
void executar(); // Bucle principal de l'escena
|
|
|
|
private:
|
|
SDLManager& sdl_;
|
|
float temps_acumulat_;
|
|
|
|
// Estructura per a cada lletra del logo
|
|
struct LetraLogo {
|
|
std::shared_ptr<Graphics::Shape> forma;
|
|
Punt posicio; // Posició final en pantalla
|
|
float ancho; // Ancho del bounding box
|
|
float offset_centre; // Distància de min_x a shape_centre.x
|
|
};
|
|
|
|
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
|
|
|
|
// Mètodes privats
|
|
void inicialitzar_lletres();
|
|
void actualitzar(float delta_time);
|
|
void dibuixar();
|
|
void processar_events(const SDL_Event& event);
|
|
};
|