57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <SDL2/SDL.h>
|
|
#include "common/texture.h"
|
|
|
|
#ifndef FADE_H
|
|
#define FADE_H
|
|
|
|
// Tipos de fundido
|
|
#define FADE_FULLSCREEN 0
|
|
#define FADE_CENTER 1
|
|
#define FADE_RANDOM_SQUARE 2
|
|
|
|
// Clase Fade
|
|
class Fade
|
|
{
|
|
private:
|
|
SDL_Renderer *mRenderer; // El renderizador de la ventana
|
|
SDL_Texture *mBackbuffer; // Textura para usar como backbuffer
|
|
Uint8 mFadeType; // Tipo de fade a realizar
|
|
Uint16 mCounter; // Contador interno
|
|
bool mEnabled; // Indica si el fade está activo
|
|
bool mFinished; // Indica si ha terminado la transición
|
|
Uint8 mR, mG, mB; // Colores para el fade
|
|
SDL_Rect mRect1; // Rectangulo usado para crear los efectos de transición
|
|
SDL_Rect mRect2; // Rectangulo usado para crear los efectos de transición
|
|
|
|
public:
|
|
// Constructor
|
|
Fade(SDL_Renderer *renderer);
|
|
|
|
// Destructor
|
|
~Fade();
|
|
|
|
// Inicializa las variables
|
|
void init(Uint8 r, Uint8 g, Uint8 b);
|
|
|
|
// Pinta una transición en pantalla
|
|
void render();
|
|
|
|
// Actualiza las variables internas
|
|
void update();
|
|
|
|
// Activa el fade
|
|
void activateFade();
|
|
|
|
// Comprueba si ha terminado la transicion
|
|
bool hasEnded();
|
|
|
|
// Comprueba si está activo
|
|
bool isEnabled();
|
|
|
|
// Establece el tipo de fade
|
|
void setFadeType(Uint8 fadeType);
|
|
};
|
|
|
|
#endif |