Cambiada la variable section por un puntero

This commit is contained in:
2022-12-16 09:32:33 +01:00
parent 2abde36a5e
commit 4d8bb46a52
22 changed files with 191 additions and 216 deletions

View File

@@ -5,13 +5,14 @@
#include <iostream>
// Constructor
EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options, section_t section)
EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options, section_t *section)
{
// Copia la dirección de los objetos
this->renderer = renderer;
this->screen = screen;
this->asset = asset;
this->options = options;
this->section = section;
// Reserva memoria para los punteros
eventHandler = new SDL_Event();
@@ -36,11 +37,10 @@ EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t
pos = 0;
name[pos] = 0;
maxLenght = 15;
this->section.subsection = section.subsection;
if (options->online.enabled && options->online.jailerID == "")
{
this->section.name = SECTION_PROG_ENTER_ID;
this->section->name = SECTION_PROG_ENTER_ID;
}
else
{
@@ -60,18 +60,16 @@ EnterID::~EnterID()
}
// Bucle para el logo del juego
section_t EnterID::run()
void EnterID::run()
{
// Detiene la música
JA_StopMusic();
while (section.name == SECTION_PROG_ENTER_ID)
while (section->name == SECTION_PROG_ENTER_ID)
{
update();
render();
}
return section;
}
// Comprueba el manejador de eventos
@@ -83,7 +81,7 @@ void EnterID::checkEventHandler()
// Evento de salida de la aplicación
if (eventHandler->type == SDL_QUIT)
{
section.name = SECTION_PROG_QUIT;
section->name = SECTION_PROG_QUIT;
break;
}
@@ -138,7 +136,7 @@ void EnterID::checkEventHandler()
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_ESCAPE)
{
section.name = SECTION_PROG_QUIT;
section->name = SECTION_PROG_QUIT;
break;
}
@@ -314,6 +312,6 @@ void EnterID::initOnline()
void EnterID::endSection()
{
initOnline();
section.name = (section.subsection == SUBSECTION_LOGO_TO_INTRO) ? SECTION_PROG_INTRO : SECTION_PROG_TITLE;
section.subsection = 0;
section->name = (section->subsection == SUBSECTION_LOGO_TO_INTRO) ? SECTION_PROG_INTRO : SECTION_PROG_TITLE;
section->subsection = 0;
}