#pragma once #include #include "common/animatedsprite.h" #include "common/asset.h" #include "common/jail_audio.h" #include "common/screen.h" #include "common/sprite.h" #include "common/text.h" #include "common/texture.h" #include "common/utils.h" #include "const.h" #include #ifndef CREDITS_H #define CREDITS_H class Credits { private: struct captions_t { std::string label; // Texto a escribir color_t color; // Color del texto }; // Objetos y punteros SDL_Renderer *renderer; // El renderizador de la ventana Screen *screen; // Objeto encargado de dibujar en pantalla Asset *asset; // Objeto con los ficheros de recursos SDL_Event *eventHandler; // Manejador de eventos Text *text; // Objeto para escribir texto en pantalla SDL_Texture *textTexture; // Textura para dibujar el texto SDL_Texture *coverTexture; // Textura para cubrir el texto Texture *texture; // Textura para el sprite de brillo AnimatedSprite *sprite; // Sprite para el brillo del corazón options_t *options; // Puntero a las opciones del juego // Variables int counter; // Contador bool counterEnabled; // Indica si esta activo el contador int subCounter; // Contador secundario section_t section; // Estado del bucle principal para saber si continua o se sale Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa std::vector texts; // Vector con las letras de la marquesina // Actualiza las variables void update(); // Dibuja en pantalla void render(); // Comprueba el manejador de eventos void checkEventHandler(); // Actualiza el contador void updateCounter(); // Escribe el texto en la textura void fillTexture(); public: // Constructor Credits(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options); // Destructor ~Credits(); // Bucle principal section_t run(); }; #endif