47 lines
1.7 KiB
C++
47 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <memory> // Para shared_ptr
|
|
#include <string> // Para string
|
|
#include <vector> // Para vector
|
|
class SurfaceAnimatedSprite; // lines 11-11
|
|
class Surface;
|
|
|
|
class Credits {
|
|
public:
|
|
// --- Constructor y Destructor ---
|
|
Credits();
|
|
~Credits() = default;
|
|
|
|
// --- Bucle principal ---
|
|
void run();
|
|
|
|
private:
|
|
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 ---
|
|
int counter_ = 0; // Contador
|
|
bool counter_enabled_ = true; // Indica si esta activo el contador
|
|
int sub_counter_ = 0; // Contador secundario
|
|
Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
|
|
std::vector<Captions> texts_; // Vector con los textos
|
|
|
|
// --- Funciones ---
|
|
void update(); // Actualiza las variables
|
|
void render(); // Dibuja en pantalla
|
|
static void checkEvents(); // Comprueba el manejador de eventos
|
|
static void checkInput(); // Comprueba las entradas
|
|
void updateCounter(); // Actualiza el contador
|
|
void iniTexts(); // Inicializa los textos
|
|
void fillTexture(); // Escribe el texto en la textura
|
|
};
|