forked from jaildesigner-jailgames/jaildoctors_dilemma
Trabajando en las notificaciones
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options)
|
||||
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;
|
||||
@@ -31,13 +31,22 @@ EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t
|
||||
|
||||
// Inicializa variables
|
||||
counter = 0;
|
||||
section.name = SECTION_PROG_ENTER_ID;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
pos = 0;
|
||||
name[pos] = 0;
|
||||
maxLenght = 15;
|
||||
|
||||
if (options->online.enabled && options->online.jailerID == "")
|
||||
{
|
||||
this->section.name = SECTION_PROG_ENTER_ID;
|
||||
this->section.subsection = section.subsection;
|
||||
}
|
||||
else
|
||||
{
|
||||
endSection();
|
||||
}
|
||||
|
||||
// Escribe el texto en la textura
|
||||
fillTexture();
|
||||
}
|
||||
@@ -92,7 +101,6 @@ void EnterID::checkEventHandler()
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
{
|
||||
|
||||
if (eventHandler->key.keysym.scancode >= SDL_SCANCODE_A && eventHandler->key.keysym.scancode <= SDL_SCANCODE_Z)
|
||||
{ // Si pulsa una letra
|
||||
if (pos < maxLenght)
|
||||
@@ -101,6 +109,7 @@ void EnterID::checkEventHandler()
|
||||
name[pos] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode >= SDL_SCANCODE_1 && eventHandler->key.keysym.scancode <= SDL_SCANCODE_9)
|
||||
{ // Si pulsa un número
|
||||
if (pos < maxLenght)
|
||||
@@ -109,6 +118,7 @@ void EnterID::checkEventHandler()
|
||||
name[pos] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_0)
|
||||
{
|
||||
if (pos < maxLenght)
|
||||
@@ -117,6 +127,7 @@ void EnterID::checkEventHandler()
|
||||
name[pos] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_BACKSPACE)
|
||||
{
|
||||
if (pos > 0)
|
||||
@@ -199,7 +210,7 @@ void EnterID::render()
|
||||
// Escribe el jailerID
|
||||
const std::string jailerID = (std::string)name + cursor;
|
||||
const color_t color = stringToColor(options->palette, "white");
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, 97, jailerID, 1, color);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, (16 * 8 + 1), jailerID, 1, color);
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
@@ -211,6 +222,8 @@ void EnterID::iniTexts()
|
||||
texts.clear();
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"ONLINE CONFIGURATION:", stringToColor(options->palette, "red")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"YOU HAVE NOT SPECIFIED ANY ID", stringToColor(options->palette, "white")});
|
||||
@@ -220,6 +233,7 @@ void EnterID::iniTexts()
|
||||
texts.push_back({"LEAVE BLANK FOR OFFLINE MODE", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"JAILER_ID:", stringToColor(options->palette, "red")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
@@ -230,9 +244,6 @@ void EnterID::iniTexts()
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
}
|
||||
|
||||
// Escribe el texto en la textura
|
||||
|
||||
Reference in New Issue
Block a user