Files
jaildoctors_dilemma/source/sections/credits.h
Sergio Valor 78c5333144 Redistribuits els .cpp en carpetes
Actualitzat cmake
Modificats els include de SDL2 a SDL3
2025-10-15 08:28:57 +02:00

61 lines
1.7 KiB
C++

#pragma once
#include <SDL3/SDL_stdinc.h> // Para Uint32, Uint8
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <vector> // Para vector
class SAnimatedSprite; // lines 11-11
class Surface;
class Credits {
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<SAnimatedSprite> 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
// Actualiza las variables
void update();
// Dibuja en pantalla
void render();
// Comprueba el manejador de eventos
void checkEvents();
// Comprueba las entradas
void checkInput();
// Actualiza el contador
void updateCounter();
// Inicializa los textos
void iniTexts();
// Escribe el texto en la textura
void fillTexture();
public:
// Constructor
Credits();
// Destructor
~Credits() = default;
// Bucle principal
void run();
};