Completado el ciclo para pedir el ID online. Añadido sonido a las notificaciones. Agregado control de versión del fichero de configuración

This commit is contained in:
2022-11-23 16:59:40 +01:00
parent 706ad6f9c0
commit a8b467290f
14 changed files with 95 additions and 130 deletions

View File

@@ -40,9 +40,6 @@ EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t
// Escribe el texto en la textura
fillTexture();
// Deja el texto a tamaño fijo
// text->setFixedWidth(true);
}
// Destructor
@@ -81,6 +78,17 @@ void EnterID::checkEventHandler()
break;
}
// El ENTER solo se comprueba cuando se suelta, para no saltarse la siguiente sección
if ((eventHandler->type == SDL_KEYUP && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONUP))
{
if (eventHandler->key.keysym.scancode == SDL_SCANCODE_RETURN)
{
options->online.jailerID = (std::string)name;
endSection();
break;
}
}
// Comprueba las teclas que se han pulsado
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
{
@@ -116,13 +124,7 @@ void EnterID::checkEventHandler()
name[--pos] = 0;
}
}
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_RETURN)
{
options->online.jailerID = (std::string)name;
initOnline();
section.name = SECTION_PROG_INTRO;
break;
}
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_ESCAPE)
{
section.name = SECTION_PROG_QUIT;
@@ -286,4 +288,12 @@ void EnterID::initOnline()
std::cout << caption << std::endl;
}
}
}
// Termina la sección
void EnterID::endSection()
{
initOnline();
section.name = (section.subsection == SUBSECTION_LOGO_TO_INTRO) ? SECTION_PROG_INTRO : SECTION_PROG_TITLE;
section.subsection = 0;
}