Ya se puede cambiar el JailerID desde la pantalla de titulo

This commit is contained in:
2023-09-24 08:53:11 +02:00
parent 6f1eee21b9
commit 458be05547
3 changed files with 29 additions and 13 deletions

View File

@@ -12,6 +12,7 @@ EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t
this->screen = screen; this->screen = screen;
this->asset = asset; this->asset = asset;
this->options = options; this->options = options;
this->section = section;
// Reserva memoria para los punteros // Reserva memoria para los punteros
eventHandler = new SDL_Event(); eventHandler = new SDL_Event();
@@ -38,15 +39,6 @@ EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t
name[pos] = 0; name[pos] = 0;
maxLenght = 15; maxLenght = 15;
if (options->online.enabled && options->online.jailerID == "")
{
loopRunning = true;
}
else
{
endSection();
}
// Escribe el texto en la textura // Escribe el texto en la textura
fillTexture(); fillTexture();
} }
@@ -59,12 +51,9 @@ EnterID::~EnterID()
delete texture; delete texture;
} }
// Bucle para el logo del juego // Bucle principal
void EnterID::run() void EnterID::run()
{ {
// Detiene la música
JA_StopMusic();
while (loopRunning) while (loopRunning)
{ {
update(); update();

View File

@@ -693,6 +693,20 @@ void Title::checkEvents()
// Reinicia el contador // Reinicia el contador
counter = TITLE_COUNTER; 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; 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 // Modifica las opciones para los controles de los jugadores
bool Title::updatePlayerInputs(int numPlayer) bool Title::updatePlayerInputs(int numPlayer)
{ {

View File

@@ -14,6 +14,7 @@
#include "const.h" #include "const.h"
#include "fade.h" #include "fade.h"
#include "game.h" #include "game.h"
#include "enter_id.h"
#include "hiscore_table.h" #include "hiscore_table.h"
#include "instructions.h" #include "instructions.h"
#include "item.h" #include "item.h"
@@ -51,6 +52,7 @@ private:
Instructions *instructions; // Objeto para la sección de las instrucciones Instructions *instructions; // Objeto para la sección de las instrucciones
HiScoreTable *hiScoreTable; // Objeto para mostrar las mejores puntuaciones online HiScoreTable *hiScoreTable; // Objeto para mostrar las mejores puntuaciones online
Game *demoGame; // Objeto para lanzar la demo del juego Game *demoGame; // Objeto para lanzar la demo del juego
EnterID *enterID; // Objeto para introducir o modificar el JailerID
SDL_Event *eventHandler; // Manejador de eventos SDL_Event *eventHandler; // Manejador de eventos
section_t *section; // Indicador para el bucle del titulo section_t *section; // Indicador para el bucle del titulo
@@ -129,6 +131,9 @@ private:
// Ejecuta el juego en modo demo // Ejecuta el juego en modo demo
void runDemoGame(); void runDemoGame();
// Introduce el JailerID
void runEnterID();
// Modifica las opciones para los controles de los jugadores // Modifica las opciones para los controles de los jugadores
bool updatePlayerInputs(int numPlayer); bool updatePlayerInputs(int numPlayer);