forked from jaildesigner-jailgames/jaildoctors_dilemma
Trabajando en las notificaciones
This commit is contained in:
@@ -364,7 +364,9 @@ void Screen::renderNotifications()
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_RenderSetLogicalSize(renderer, windowWidth * 2, windowHeight * 2);
|
||||
// SDL_RenderSetLogicalSize(renderer, windowWidth * 2, windowHeight * 2);
|
||||
const int mult = 1 + ((options->windowSize - 1) / 2);
|
||||
SDL_RenderSetLogicalSize(renderer, windowWidth * mult, windowHeight * mult);
|
||||
notify->render();
|
||||
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
||||
}
|
||||
@@ -304,7 +304,7 @@ bool Director::saveConfig()
|
||||
|
||||
// Escribe en el fichero
|
||||
file << "## VERSION\n";
|
||||
file << "version=" + options->configVersion + "\n";
|
||||
file << "configVersion=" + options->configVersion + "\n";
|
||||
|
||||
file << "\n## VISUAL OPTIONS\n";
|
||||
if (options->videoMode == 0)
|
||||
@@ -1665,7 +1665,7 @@ void Director::runEnterID()
|
||||
std::cout << "\n* SECTION: ENTER_ID" << std::endl;
|
||||
}
|
||||
// loadResources(section);
|
||||
enterID = new EnterID(renderer, screen, asset, options);
|
||||
enterID = new EnterID(renderer, screen, asset, options, section);
|
||||
setSection(enterID->run());
|
||||
delete enterID;
|
||||
resource->free();
|
||||
|
||||
@@ -48,9 +48,9 @@ private:
|
||||
struct options_t *options; // Variable con todas las opciones del programa
|
||||
|
||||
// Variables
|
||||
section_t section; // Sección y subsección actual del programa;
|
||||
JA_Music music; // Musica del titulo
|
||||
std::string executablePath; // Path del ejecutable
|
||||
section_t section; // Sección y subsección actual del programa;
|
||||
std::string systemFolder; // Carpeta del sistema donde guardar datos
|
||||
|
||||
// Crea e inicializa las opciones del programa
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options);
|
||||
EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options, section_t section);
|
||||
|
||||
// Destructor
|
||||
~EnterID();
|
||||
|
||||
@@ -82,7 +82,7 @@ void Logo::checkEventHandler()
|
||||
}
|
||||
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
if ((eventHandler->type == SDL_KEYUP && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONUP))
|
||||
{
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
@@ -125,6 +125,7 @@ void Logo::checkEventHandler()
|
||||
break;
|
||||
|
||||
default:
|
||||
section.subsection = SUBSECTION_LOGO_TO_TITLE;
|
||||
endSection();
|
||||
break;
|
||||
}
|
||||
@@ -316,13 +317,14 @@ void Logo::switchPalette()
|
||||
|
||||
// Termina la sección
|
||||
void Logo::endSection()
|
||||
{
|
||||
if (options->online.enabled && options->online.jailerID == "")
|
||||
{
|
||||
section.name = SECTION_PROG_ENTER_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
section.name = (section.subsection == SUBSECTION_LOGO_TO_INTRO) ? SECTION_PROG_INTRO : SECTION_PROG_TITLE;
|
||||
}
|
||||
//if (options->online.enabled && options->online.jailerID == "")
|
||||
//{
|
||||
// section.name = SECTION_PROG_ENTER_ID;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// section.name = (section.subsection == SUBSECTION_LOGO_TO_INTRO) ? SECTION_PROG_INTRO : SECTION_PROG_TITLE;
|
||||
//}
|
||||
}
|
||||
Reference in New Issue
Block a user