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;
#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<std::string> offsetsList;
offsetsList.push_back("smb2.txt");
offsetsList.push_back("debug.txt");
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);
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();
}

View File

@@ -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();