Trabajando en el escalado de las notificaciones

This commit is contained in:
2022-11-23 14:11:47 +01:00
parent 54d428ed96
commit 706ad6f9c0
4 changed files with 38 additions and 36 deletions

View File

@@ -135,7 +135,7 @@ void Notify::showText(std::string text)
SDL_SetRenderDrawColor(renderer, bgColor.r, bgColor.g, bgColor.b, 255);
SDL_RenderClear(renderer);
n.texture->setBlendMode(SDL_BLENDMODE_BLEND);
this->text->writeDX(TXT_CENTER | TXT_STROKE, width / 2, despV, text, 1, {255, 255, 255}, 2, {0, 0, 0});
this->text->writeDX(TXT_CENTER | TXT_STROKE, width / 2, despV, text, 1, {255, 255, 255}, 1, {0, 0, 0});
SDL_SetRenderTarget(renderer, nullptr);
// Crea el sprite

View File

@@ -18,7 +18,7 @@ Director::Director(int argc, char *argv[])
section.subsection = SUBSECTION_LOGO_TO_INTRO;
#ifdef DEBUG
section.name = SECTION_PROG_LOGO;
section.name = SECTION_PROG_GAME;
#endif
// Crea e inicializa las opciones del programa
@@ -84,50 +84,25 @@ Director::~Director()
// Inicializa los servicios online
void Director::initOnline()
{
//if (!options->online.enabled)
//{
// return;
//}
options->online.enabled = true;
// Obten el Jailer ID
if (options->online.jailerID == "")
{ // Jailer ID no definido
screen->showText("No ha especificado ningun Jailer ID");
if (options->console)
{
std::cout << "No ha especificado ningun Jailer ID" << std::endl;
}
options->online.enabled = false;
}
else
{ // Jailer ID iniciado
// Establece el servidor y el puerto
if (options->online.enabled)
{ // Establece el servidor y el puerto
jscore::init(options->online.server, options->online.port);
// Obtiene la información online
if (jscore::initOnlineScore(options->online.gameID))
{
screen->showText(options->online.jailerID + " ha iniciado sesion");
const std::string caption = options->online.jailerID + " IS LOGGED IN";
screen->showText(caption);
if (options->console)
{
std::cout << options->online.jailerID << " ha iniciado sesion" << std::endl;
std::cout << caption << std::endl;
}
}
else
{
screen->showText("Fallo al conectar a " + options->online.server);
if (options->console)
{
std::cout << "Fallo al conectar a " << options->online.server << std::endl;
}
options->online.enabled = false;
return;
}
}
}

View File

@@ -1,4 +1,5 @@
#include "common/jail_audio.h"
#include "common/jscore.h"
#include "const.h"
#include "enter_id.h"
#include <iostream>
@@ -118,6 +119,7 @@ void EnterID::checkEventHandler()
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_RETURN)
{
options->online.jailerID = (std::string)name;
initOnline();
section.name = SECTION_PROG_INTRO;
break;
}
@@ -195,7 +197,6 @@ void EnterID::render()
// Escribe el jailerID
const std::string jailerID = (std::string)name + cursor;
const color_t color = stringToColor(options->palette, "white");
//text->writeCentered(GAMECANVAS_CENTER_X, 97, jailerID);
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, 97, jailerID, 1, color);
// Vuelca el contenido del renderizador en pantalla
@@ -263,3 +264,26 @@ void EnterID::switchPalette()
options->palette = options->palette == p_zxspectrum ? p_zxarne : p_zxspectrum;
fillTexture();
}
// Inicializa los servicios online
void EnterID::initOnline()
{
if (options->online.jailerID == "")
{ // Jailer ID no definido
options->online.enabled = false;
}
else
{ // Jailer ID iniciado
options->online.enabled = true;
jscore::init(options->online.server, options->online.port);
const std::string caption = options->online.jailerID + " IS LOGGED IN";
screen->showText(caption);
if (options->console)
{
std::cout << caption << std::endl;
}
}
}

View File

@@ -60,6 +60,9 @@ private:
// Cambia la paleta
void switchPalette();
// Inicializa los servicios online
void initOnline();
public:
// Constructor
EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options);