Añadida barra de información en el titulo

This commit is contained in:
2023-09-15 11:44:51 +02:00
parent b1887fe6da
commit 663e1ed32e
3 changed files with 25 additions and 2 deletions

View File

@@ -19,7 +19,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_GAME; section->name = SECTION_PROG_INTRO;
#endif #endif
// Crea e inicializa las opciones del programa // 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 // Estos valores no se guardan en el fichero de configuraci´ón
options->console = false; options->console = false;
#ifdef DEBUG
options->console = true;
#endif
options->cheat.infiniteLives = false; options->cheat.infiniteLives = false;
options->cheat.invincible = false; options->cheat.invincible = false;
options->cheat.jailEnabled = false; options->cheat.jailEnabled = false;
@@ -155,7 +158,7 @@ void Director::initOptions()
options->online.server = "jaildoctor.duckdns.org"; options->online.server = "jaildoctor.duckdns.org";
options->online.port = 9911; options->online.port = 9911;
#ifdef DEBUG #ifdef DEBUG
options->online.gameID = "jaildoctors_dilemma_test"; options->online.gameID = "jaildoctors_dilemma_debug";
#else #else
options->online.gameID = "jaildoctors_dilemma"; options->online.gameID = "jaildoctors_dilemma";
#endif #endif
@@ -497,12 +500,14 @@ void Director::loadResources(section_t *section)
textureList.push_back("loading_screen_color.png"); textureList.push_back("loading_screen_color.png");
textureList.push_back("loading_screen_color_zxarne.png"); textureList.push_back("loading_screen_color_zxarne.png");
textureList.push_back("smb2.png"); textureList.push_back("smb2.png");
textureList.push_back("debug.png");
resource->loadTextures(textureList); resource->loadTextures(textureList);
// Offsets // Offsets
std::vector<std::string> offsetsList; std::vector<std::string> offsetsList;
offsetsList.push_back("smb2.txt"); offsetsList.push_back("smb2.txt");
offsetsList.push_back("debug.txt");
resource->loadOffsets(offsetsList); resource->loadOffsets(offsetsList);
} }

View File

@@ -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); sprite = new Sprite(0, 0, texture->getWidth(), texture->getHeight(), texture, renderer);
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), 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 // Inicializa variables
counter = 0; counter = 0;
@@ -74,6 +75,7 @@ Title::~Title()
delete pressEnterSprite; delete pressEnterSprite;
delete pressEnterTexture; delete pressEnterTexture;
delete text; delete text;
delete infoText;
} }
// Comprueba el manejador de eventos // 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 // Actualiza las variables
void Title::update() void Title::update()
{ {
@@ -223,6 +234,9 @@ void Title::render()
// Dibuja la marquesina // Dibuja la marquesina
renderMarquee(); renderMarquee();
// Dibuja la linea de información inferior
renderInfo();
// Vuelca el contenido del renderizador en pantalla // Vuelca el contenido del renderizador en pantalla
screen->blit(); screen->blit();
} }

View File

@@ -35,6 +35,7 @@ private:
Texture *texture; // Textura con los graficos Texture *texture; // Textura con los graficos
Sprite *sprite; // Sprite para manejar la textura Sprite *sprite; // Sprite para manejar la textura
Text *text; // Objeto para escribir texto en pantalla 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 options_t *options; // Puntero a las opciones del juego
Texture *pressEnterTexture; // Textura con los graficos de PRESS ENTER Texture *pressEnterTexture; // Textura con los graficos de PRESS ENTER
Sprite *pressEnterSprite; // Sprite para manejar la textura de PRESS ENTER Sprite *pressEnterSprite; // Sprite para manejar la textura de PRESS ENTER
@@ -66,6 +67,9 @@ private:
// Dibuja la marquesina // Dibuja la marquesina
void renderMarquee(); void renderMarquee();
// Dibuja la linea de información inferior
void renderInfo();
// Recarga las texturas // Recarga las texturas
void reLoadTextures(); void reLoadTextures();