Añadido efecto de flash a la clase Screen
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// Constructor
|
||||
Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, section_t *section)
|
||||
{
|
||||
// Copia las direcciones de los punteros
|
||||
// Copia las direcciones de los punteros y objetos
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->input = input;
|
||||
@@ -12,7 +12,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
||||
this->lang = lang;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros
|
||||
// Reserva memoria y crea los objetos
|
||||
eventHandler = new SDL_Event();
|
||||
fade = new Fade(renderer);
|
||||
|
||||
@@ -48,6 +48,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
||||
// Destructor
|
||||
Title::~Title()
|
||||
{
|
||||
// Destruye los objetos y libera la memoria
|
||||
delete eventHandler;
|
||||
delete fade;
|
||||
|
||||
@@ -76,7 +77,7 @@ Title::~Title()
|
||||
SDL_DestroyTexture(background);
|
||||
}
|
||||
|
||||
// Inicializa los valores
|
||||
// Inicializa los valores de las variables
|
||||
void Title::init()
|
||||
{
|
||||
// Inicializa variables
|
||||
@@ -122,7 +123,7 @@ void Title::init()
|
||||
options->input[1].deviceType = availableInputDevices[deviceIndex[1]].deviceType;
|
||||
}
|
||||
|
||||
// Inicializa el bitmap de Coffee
|
||||
// Inicializa el bitmap de 'Coffee'
|
||||
coffeeBitmap->init();
|
||||
coffeeBitmap->setPosX(45);
|
||||
coffeeBitmap->setPosY(11 - 200);
|
||||
@@ -138,7 +139,7 @@ void Title::init()
|
||||
coffeeBitmap->setDestX(45);
|
||||
coffeeBitmap->setDestY(11);
|
||||
|
||||
// Inicializa el bitmap de Crisis
|
||||
// Inicializa el bitmap de 'Crisis'
|
||||
crisisBitmap->init();
|
||||
crisisBitmap->setPosX(60);
|
||||
crisisBitmap->setPosY(57 + 200);
|
||||
@@ -154,7 +155,7 @@ void Title::init()
|
||||
crisisBitmap->setDestX(60);
|
||||
crisisBitmap->setDestY(57);
|
||||
|
||||
// Inicializa el bitmap de DustRight
|
||||
// Inicializa el bitmap de 'DustRight'
|
||||
dustBitmapR->resetAnimation();
|
||||
dustBitmapR->setPosX(218);
|
||||
dustBitmapR->setPosY(47);
|
||||
@@ -162,7 +163,7 @@ void Title::init()
|
||||
dustBitmapR->setHeight(16);
|
||||
dustBitmapR->setFlip(SDL_FLIP_HORIZONTAL);
|
||||
|
||||
// Inicializa el bitmap de DustLeft
|
||||
// Inicializa el bitmap de 'DustLeft'
|
||||
dustBitmapL->resetAnimation();
|
||||
dustBitmapL->setPosX(33);
|
||||
dustBitmapL->setPosY(47);
|
||||
@@ -172,7 +173,8 @@ void Title::init()
|
||||
// Crea el mosaico de fondo del titulo
|
||||
createTiledBackground();
|
||||
|
||||
// Coloca la ventana que recorre el mosaico de fondo de manera que coincida con el mosaico que hay pintado en el titulo al iniciar
|
||||
// Coloca la ventana que recorre el mosaico de fondo de manera que coincida
|
||||
// con el mosaico que hay pintado en el titulo al iniciar
|
||||
backgroundWindow.x = 128;
|
||||
backgroundWindow.y = 96;
|
||||
backgroundWindow.w = GAMECANVAS_WIDTH;
|
||||
@@ -198,6 +200,7 @@ void Title::update()
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
backgroundObj->update();
|
||||
//screen->update();
|
||||
counter++;
|
||||
|
||||
switch (section->subsection)
|
||||
@@ -215,10 +218,8 @@ void Title::update()
|
||||
section->subsection = SUBSECTION_TITLE_2;
|
||||
|
||||
// Pantallazo blanco
|
||||
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
screen->setFlash({0xFF, 0xFF, 0xFF}, 5);
|
||||
|
||||
// Reproduce el efecto sonoro
|
||||
JA_PlaySound(crashSound);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user