forked from jaildesigner-jailgames/jaildoctors_dilemma
65 lines
1.5 KiB
C++
65 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <SDL2/SDL_render.h> // for SDL_Texture
|
|
#include <SDL2/SDL_stdinc.h> // for Uint32
|
|
#include <memory> // for shared_ptr
|
|
#include <string> // for string
|
|
#include <vector> // for vector
|
|
#include "utils.h" // for Color
|
|
#include <memory>
|
|
#include "surface.h"
|
|
class SAnimatedSprite; // lines 9-9
|
|
|
|
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();
|
|
};
|