From 663e1ed32ed97ba46d613af3926ad934d73f5990 Mon Sep 17 00:00:00 2001 From: Sergio Valor Martinez Date: Fri, 15 Sep 2023 11:44:51 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adida=20barra=20de=20informaci=C3=B3n=20?= =?UTF-8?q?en=20el=20titulo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/director.cpp | 9 +++++++-- source/title.cpp | 14 ++++++++++++++ source/title.h | 4 ++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/source/director.cpp b/source/director.cpp index da5f309..4bc0f52 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -19,7 +19,7 @@ Director::Director(int argc, char *argv[]) section->subsection = SUBSECTION_LOGO_TO_INTRO; #ifdef DEBUG - section->name = SECTION_PROG_GAME; + section->name = SECTION_PROG_INTRO; #endif // Crea e inicializa las opciones del programa @@ -142,6 +142,9 @@ void Director::initOptions() // Estos valores no se guardan en el fichero de configuraci´ón options->console = false; +#ifdef DEBUG + options->console = true; +#endif options->cheat.infiniteLives = false; options->cheat.invincible = false; options->cheat.jailEnabled = false; @@ -155,7 +158,7 @@ void Director::initOptions() options->online.server = "jaildoctor.duckdns.org"; options->online.port = 9911; #ifdef DEBUG - options->online.gameID = "jaildoctors_dilemma_test"; + options->online.gameID = "jaildoctors_dilemma_debug"; #else options->online.gameID = "jaildoctors_dilemma"; #endif @@ -497,12 +500,14 @@ void Director::loadResources(section_t *section) textureList.push_back("loading_screen_color.png"); textureList.push_back("loading_screen_color_zxarne.png"); textureList.push_back("smb2.png"); + textureList.push_back("debug.png"); resource->loadTextures(textureList); // Offsets std::vector offsetsList; offsetsList.push_back("smb2.txt"); + offsetsList.push_back("debug.txt"); resource->loadOffsets(offsetsList); } diff --git a/source/title.cpp b/source/title.cpp index 80a260f..3eccd17 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -24,6 +24,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset * } sprite = new Sprite(0, 0, texture->getWidth(), texture->getHeight(), texture, renderer); text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer); + infoText = new Text(resource->getOffset("debug.txt"), resource->getTexture("debug.png"), renderer); // Inicializa variables counter = 0; @@ -74,6 +75,7 @@ Title::~Title() delete pressEnterSprite; delete pressEnterTexture; delete text; + delete infoText; } // Comprueba el manejador de eventos @@ -172,6 +174,15 @@ void Title::renderMarquee() } } +// Dibuja la linea de información inferior +void Title::renderInfo() +{ + const std::string loginText = options->online.enabled ? "OnLine: " + options->online.jailerID : "OnLine: OFF"; + infoText->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_FIRST_QUARTER_X, 1, loginText, 1, stringToColor(options->palette, "white")); + infoText->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, 1, "H: Help", 1, stringToColor(options->palette, "white")); + infoText->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_THIRD_QUARTER_X, 1, "A: Achievements", 1, stringToColor(options->palette, "white")); +} + // Actualiza las variables void Title::update() { @@ -223,6 +234,9 @@ void Title::render() // Dibuja la marquesina renderMarquee(); + // Dibuja la linea de información inferior + renderInfo(); + // Vuelca el contenido del renderizador en pantalla screen->blit(); } diff --git a/source/title.h b/source/title.h index dd7a064..c0a0c49 100644 --- a/source/title.h +++ b/source/title.h @@ -35,6 +35,7 @@ private: Texture *texture; // Textura con los graficos Sprite *sprite; // Sprite para manejar la textura Text *text; // Objeto para escribir texto en pantalla + Text *infoText; // Objeto para escribir texto en pantalla options_t *options; // Puntero a las opciones del juego Texture *pressEnterTexture; // Textura con los graficos de PRESS ENTER Sprite *pressEnterSprite; // Sprite para manejar la textura de PRESS ENTER @@ -66,6 +67,9 @@ private: // Dibuja la marquesina void renderMarquee(); + // Dibuja la linea de información inferior + void renderInfo(); + // Recarga las texturas void reLoadTextures();