forked from jaildesigner-jailgames/jaildoctors_dilemma
Cambiada la variable section por un puntero
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "intro.h"
|
||||
|
||||
// Constructor
|
||||
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options)
|
||||
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section)
|
||||
{
|
||||
// Copia la dirección de los objetos
|
||||
this->resource = resource;
|
||||
@@ -9,6 +9,7 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
||||
this->screen = screen;
|
||||
this->asset = asset;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros
|
||||
eventHandler = new SDL_Event();
|
||||
@@ -31,8 +32,8 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
||||
// Inicializa variables
|
||||
preCounter = 0;
|
||||
counter = 0;
|
||||
section.name = SECTION_PROG_INTRO;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_PROG_INTRO;
|
||||
section->subsection = 0;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
loadCounter = 0;
|
||||
@@ -82,7 +83,7 @@ void Intro::checkEventHandler()
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ void Intro::checkEventHandler()
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_B:
|
||||
@@ -130,8 +131,8 @@ void Intro::checkEventHandler()
|
||||
break;
|
||||
|
||||
default:
|
||||
section.name = SECTION_PROG_TITLE;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_PROG_TITLE;
|
||||
section->subsection = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -179,8 +180,8 @@ void Intro::updateLoad()
|
||||
// Comprueba si ha terminado la intro
|
||||
if (loadCounter >= 768)
|
||||
{
|
||||
section.name = SECTION_PROG_TITLE;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_PROG_TITLE;
|
||||
section->subsection = 0;
|
||||
JA_StopMusic();
|
||||
}
|
||||
}
|
||||
@@ -240,20 +241,19 @@ void Intro::render()
|
||||
}
|
||||
|
||||
// Bucle para el logo del juego
|
||||
section_t Intro::run()
|
||||
void Intro::run()
|
||||
{
|
||||
// Inicia el sonido de carga
|
||||
JA_SetVolume(64);
|
||||
JA_PlayMusic(loadingSound1);
|
||||
|
||||
while (section.name == SECTION_PROG_INTRO)
|
||||
while (section->name == SECTION_PROG_INTRO)
|
||||
{
|
||||
update();
|
||||
render();
|
||||
}
|
||||
|
||||
JA_SetVolume(128);
|
||||
return section;
|
||||
}
|
||||
|
||||
// Cambia la paleta
|
||||
|
||||
Reference in New Issue
Block a user