diff --git a/source/enter_id.cpp b/source/enter_id.cpp index 63be05b..2884fc5 100644 --- a/source/enter_id.cpp +++ b/source/enter_id.cpp @@ -12,6 +12,7 @@ EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t this->screen = screen; this->asset = asset; this->options = options; + this->section = section; // Reserva memoria para los punteros eventHandler = new SDL_Event(); @@ -38,15 +39,6 @@ EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t name[pos] = 0; maxLenght = 15; - if (options->online.enabled && options->online.jailerID == "") - { - loopRunning = true; - } - else - { - endSection(); - } - // Escribe el texto en la textura fillTexture(); } @@ -59,12 +51,9 @@ EnterID::~EnterID() delete texture; } -// Bucle para el logo del juego +// Bucle principal void EnterID::run() { - // Detiene la música - JA_StopMusic(); - while (loopRunning) { update(); diff --git a/source/title.cpp b/source/title.cpp index 57a732f..c4b42ec 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -693,6 +693,20 @@ void Title::checkEvents() // Reinicia el contador counter = TITLE_COUNTER; } + + if (eventHandler->type == SDL_KEYDOWN) + { + switch (eventHandler->key.keysym.scancode) + { + case SDL_SCANCODE_A: + std::cout << "PULSA A" << std::endl; + runEnterID(); + break; + + default: + break; + } + } } } } @@ -1009,6 +1023,14 @@ void Title::runDemoGame() delete demoGame; } +// Introduce el JailerID +void Title::runEnterID() +{ + enterID = new EnterID(renderer, screen, asset, options, section); + enterID->run(); + delete enterID; +} + // Modifica las opciones para los controles de los jugadores bool Title::updatePlayerInputs(int numPlayer) { diff --git a/source/title.h b/source/title.h index b2f2e1a..ec34005 100644 --- a/source/title.h +++ b/source/title.h @@ -14,6 +14,7 @@ #include "const.h" #include "fade.h" #include "game.h" +#include "enter_id.h" #include "hiscore_table.h" #include "instructions.h" #include "item.h" @@ -51,6 +52,7 @@ private: Instructions *instructions; // Objeto para la sección de las instrucciones HiScoreTable *hiScoreTable; // Objeto para mostrar las mejores puntuaciones online Game *demoGame; // Objeto para lanzar la demo del juego + EnterID *enterID; // Objeto para introducir o modificar el JailerID SDL_Event *eventHandler; // Manejador de eventos section_t *section; // Indicador para el bucle del titulo @@ -129,6 +131,9 @@ private: // Ejecuta el juego en modo demo void runDemoGame(); + // Introduce el JailerID + void runEnterID(); + // Modifica las opciones para los controles de los jugadores bool updatePlayerInputs(int numPlayer);