style: deixant guapetes les capçaleres de les classes

This commit is contained in:
2025-11-10 13:53:29 +01:00
parent 5dd463ad5a
commit b70b728b75
23 changed files with 492 additions and 595 deletions

View File

@@ -19,7 +19,7 @@ class Credits {
void run();
private:
// --- Estados ---
// --- Tipos anidados ---
enum class State {
REVEALING_TEXT,
PAUSE_1,
@@ -32,6 +32,11 @@ class Credits {
EXITING
};
struct Captions {
std::string label; // Texto a escribir
Uint8 color{0}; // Color del texto
};
// --- Constantes de tiempo (basado en 60 FPS) ---
static constexpr float REVEAL_PHASE_1_DURATION = 3.733F; // 224 frames @ 60fps
static constexpr float PAUSE_DURATION = 1.667F; // 100 frames @ 60fps
@@ -43,25 +48,8 @@ class Credits {
static constexpr float SHINE_START_TIME = 12.833F; // 770 frames @ 60fps
static constexpr float FADE_OUT_START = 19.167F; // 1150 frames @ 60fps
static constexpr float REVEAL_SPEED = 60.0F; // counter equivalente por segundo @ 60fps
struct Captions {
std::string label; // Texto a escribir
Uint8 color; // Color del texto
};
// --- Objetos y punteros ---
std::shared_ptr<Surface> text_surface_; // Textura para dibujar el texto
std::shared_ptr<Surface> cover_surface_; // Textura para cubrir el texto
std::shared_ptr<SurfaceAnimatedSprite> shining_sprite_; // Sprite para el brillo del corazón
// --- Variables ---
std::unique_ptr<DeltaTimer> delta_timer_; // Temporizador delta para time-based update
State state_ = State::REVEALING_TEXT; // Estado actual
float state_time_ = 0.0F; // Tiempo acumulado en el estado actual
float total_time_ = 0.0F; // Tiempo total acumulado
float reveal_time_ = 0.0F; // Tiempo acumulado solo durante revelación (se congela en pausas)
std::vector<Captions> texts_; // Vector con los textos
// --- Funciones ---
// --- Métodos privados ---
void update(); // Actualiza las variables
void render(); // Dibuja en pantalla
static void handleEvents(); // Comprueba el manejador de eventos
@@ -70,4 +58,20 @@ class Credits {
void transitionToState(State new_state); // Transición entre estados
void iniTexts(); // Inicializa los textos
void fillTexture(); // Escribe el texto en la textura
// --- Variables miembro ---
// Recursos gráficos
std::shared_ptr<Surface> text_surface_; // Textura para dibujar el texto
std::shared_ptr<Surface> cover_surface_; // Textura para cubrir el texto
std::shared_ptr<SurfaceAnimatedSprite> shining_sprite_; // Sprite para el brillo del corazón
// Temporizadores y estado
std::unique_ptr<DeltaTimer> delta_timer_; // Temporizador delta para time-based update
State state_{State::REVEALING_TEXT}; // Estado actual
float state_time_{0.0F}; // Tiempo acumulado en el estado actual
float total_time_{0.0F}; // Tiempo total acumulado
float reveal_time_{0.0F}; // Tiempo acumulado solo durante revelación (se congela en pausas)
// Textos
std::vector<Captions> texts_; // Vector con los textos
};