forked from jaildesigner-jailgames/jaildoctors_dilemma
Trabajando en el escalado de las notificaciones
This commit is contained in:
@@ -135,7 +135,7 @@ void Notify::showText(std::string text)
|
|||||||
SDL_SetRenderDrawColor(renderer, bgColor.r, bgColor.g, bgColor.b, 255);
|
SDL_SetRenderDrawColor(renderer, bgColor.r, bgColor.g, bgColor.b, 255);
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
n.texture->setBlendMode(SDL_BLENDMODE_BLEND);
|
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);
|
SDL_SetRenderTarget(renderer, nullptr);
|
||||||
|
|
||||||
// Crea el sprite
|
// Crea el sprite
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ Director::Director(int argc, char *argv[])
|
|||||||
section.subsection = SUBSECTION_LOGO_TO_INTRO;
|
section.subsection = SUBSECTION_LOGO_TO_INTRO;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
section.name = SECTION_PROG_LOGO;
|
section.name = SECTION_PROG_GAME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Crea e inicializa las opciones del programa
|
// Crea e inicializa las opciones del programa
|
||||||
@@ -84,50 +84,25 @@ Director::~Director()
|
|||||||
// Inicializa los servicios online
|
// Inicializa los servicios online
|
||||||
void Director::initOnline()
|
void Director::initOnline()
|
||||||
{
|
{
|
||||||
//if (!options->online.enabled)
|
|
||||||
//{
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
options->online.enabled = true;
|
|
||||||
|
|
||||||
// Obten el Jailer ID
|
|
||||||
if (options->online.jailerID == "")
|
if (options->online.jailerID == "")
|
||||||
{ // Jailer ID no definido
|
{ // 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;
|
options->online.enabled = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Jailer ID iniciado
|
{ // Jailer ID iniciado
|
||||||
|
|
||||||
// Establece el servidor y el puerto
|
if (options->online.enabled)
|
||||||
jscore::init(options->online.server, options->online.port);
|
{ // Establece el servidor y el puerto
|
||||||
|
jscore::init(options->online.server, options->online.port);
|
||||||
|
|
||||||
// Obtiene la información online
|
const std::string caption = options->online.jailerID + " IS LOGGED IN";
|
||||||
if (jscore::initOnlineScore(options->online.gameID))
|
screen->showText(caption);
|
||||||
{
|
|
||||||
screen->showText(options->online.jailerID + " ha iniciado sesion");
|
|
||||||
if (options->console)
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "common/jail_audio.h"
|
#include "common/jail_audio.h"
|
||||||
|
#include "common/jscore.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "enter_id.h"
|
#include "enter_id.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -118,6 +119,7 @@ void EnterID::checkEventHandler()
|
|||||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_RETURN)
|
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_RETURN)
|
||||||
{
|
{
|
||||||
options->online.jailerID = (std::string)name;
|
options->online.jailerID = (std::string)name;
|
||||||
|
initOnline();
|
||||||
section.name = SECTION_PROG_INTRO;
|
section.name = SECTION_PROG_INTRO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -195,8 +197,7 @@ void EnterID::render()
|
|||||||
// Escribe el jailerID
|
// Escribe el jailerID
|
||||||
const std::string jailerID = (std::string)name + cursor;
|
const std::string jailerID = (std::string)name + cursor;
|
||||||
const color_t color = stringToColor(options->palette, "white");
|
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);
|
||||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, 97, jailerID,1,color);
|
|
||||||
|
|
||||||
// Vuelca el contenido del renderizador en pantalla
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
screen->blit();
|
screen->blit();
|
||||||
@@ -263,3 +264,26 @@ void EnterID::switchPalette()
|
|||||||
options->palette = options->palette == p_zxspectrum ? p_zxarne : p_zxspectrum;
|
options->palette = options->palette == p_zxspectrum ? p_zxarne : p_zxspectrum;
|
||||||
fillTexture();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -60,6 +60,9 @@ private:
|
|||||||
// Cambia la paleta
|
// Cambia la paleta
|
||||||
void switchPalette();
|
void switchPalette();
|
||||||
|
|
||||||
|
// Inicializa los servicios online
|
||||||
|
void initOnline();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options);
|
EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options);
|
||||||
|
|||||||
Reference in New Issue
Block a user