forked from jaildesigner-jailgames/jaildoctors_dilemma
Optimizado un poco el title.cpp
This commit is contained in:
@@ -27,12 +27,12 @@ Sprite::Sprite(int x, int y, int w, int h, Texture *texture, SDL_Renderer *rende
|
|||||||
Sprite::Sprite(SDL_Rect rect, Texture *texture, SDL_Renderer *renderer)
|
Sprite::Sprite(SDL_Rect rect, Texture *texture, SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
// Establece la posición X,Y del sprite
|
// Establece la posición X,Y del sprite
|
||||||
x = rect.x;
|
this->x = rect.x;
|
||||||
y = rect.y;
|
this->y = rect.y;
|
||||||
|
|
||||||
// Establece el alto y el ancho del sprite
|
// Establece el alto y el ancho del sprite
|
||||||
w = rect.w;
|
this->w = rect.w;
|
||||||
h = rect.h;
|
this->h = rect.h;
|
||||||
|
|
||||||
// Establece el puntero al renderizador de la ventana
|
// Establece el puntero al renderizador de la ventana
|
||||||
this->renderer = renderer;
|
this->renderer = renderer;
|
||||||
|
|||||||
@@ -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_INTRO;
|
section.name = SECTION_PROG_LOGO;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Crea e inicializa las opciones del programa
|
// Crea e inicializa las opciones del programa
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
|||||||
ticks = 0;
|
ticks = 0;
|
||||||
ticksSpeed = 15;
|
ticksSpeed = 15;
|
||||||
longText = "HEY JAILERS!! IT'S 2022 AND WE'RE STILL ROCKING LIKE IT'S 1998!!! HAVE YOU HEARD IT? JAILGAMES ARE BACK!! YEEESSS BACK!! MORE THAN 10 TITLES ON JAILDOC'S KITCHEN!! THATS A LOOOOOOT OF JAILGAMES, BUT WHICH ONE WILL STRIKE FIRST? THERE IS ALSO A NEW DEVICE TO COME THAT WILL BLOW YOUR MIND WITH JAILGAMES ON THE GO: P.A.C.O. BUT WAIT! WHAT'S THAT BEAUTY I'M SEEING RIGHT OVER THERE?? OOOH THAT TINY MINIASCII IS PURE LOVE!! I WANT TO LICK EVERY BYTE OF IT!! OH SHIT! AND DON'T FORGET TO BRING BACK THOSE OLD AND FAT MS-DOS JAILGAMES TO GITHUB TO KEEP THEM ALIVE!! WHAT WILL BE THE NEXT JAILDOC RELEASE? WHAT WILL BE THE NEXT PROJECT TO COME ALIVE?? OH BABY WE DON'T KNOW BUT HERE YOU CAN FIND THE ANSWER, YOU JUST HAVE TO COMPLETE JAILDOCTOR'S DILEMMA ... COULD YOU?";
|
longText = "HEY JAILERS!! IT'S 2022 AND WE'RE STILL ROCKING LIKE IT'S 1998!!! HAVE YOU HEARD IT? JAILGAMES ARE BACK!! YEEESSS BACK!! MORE THAN 10 TITLES ON JAILDOC'S KITCHEN!! THATS A LOOOOOOT OF JAILGAMES, BUT WHICH ONE WILL STRIKE FIRST? THERE IS ALSO A NEW DEVICE TO COME THAT WILL BLOW YOUR MIND WITH JAILGAMES ON THE GO: P.A.C.O. BUT WAIT! WHAT'S THAT BEAUTY I'M SEEING RIGHT OVER THERE?? OOOH THAT TINY MINIASCII IS PURE LOVE!! I WANT TO LICK EVERY BYTE OF IT!! OH SHIT! AND DON'T FORGET TO BRING BACK THOSE OLD AND FAT MS-DOS JAILGAMES TO GITHUB TO KEEP THEM ALIVE!! WHAT WILL BE THE NEXT JAILDOC RELEASE? WHAT WILL BE THE NEXT PROJECT TO COME ALIVE?? OH BABY WE DON'T KNOW BUT HERE YOU CAN FIND THE ANSWER, YOU JUST HAVE TO COMPLETE JAILDOCTOR'S DILEMMA ... COULD YOU?";
|
||||||
// longText = "HEY JAILERS!! IT'S 2022 AND WE'RE STILL ROCKING LIKE IT'S 1998!!!";
|
|
||||||
for (int i = 0; i < (int)longText.length(); ++i)
|
for (int i = 0; i < (int)longText.length(); ++i)
|
||||||
{
|
{
|
||||||
letter_t l;
|
letter_t l;
|
||||||
@@ -42,6 +41,21 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
|||||||
letters[0].enabled = true;
|
letters[0].enabled = true;
|
||||||
marqueeSpeed = 3;
|
marqueeSpeed = 3;
|
||||||
|
|
||||||
|
// Crea el cartel de PRESS ENTER
|
||||||
|
const std::string caption = "PRESS ENTER TO PLAY";
|
||||||
|
const color_t textColor = stringToColor(options->palette, "white");
|
||||||
|
const color_t strokeColor = stringToColor(options->palette, "bright_blue");
|
||||||
|
|
||||||
|
// Crea la textura
|
||||||
|
pressEnterTexture = new Texture(renderer);
|
||||||
|
pressEnterTexture->createBlank(renderer, text->lenght(caption) + 2, text->getCharacterSize() + 2, SDL_TEXTUREACCESS_TARGET);
|
||||||
|
pressEnterTexture->setAsRenderTarget(renderer);
|
||||||
|
pressEnterTexture->setBlendMode(SDL_BLENDMODE_BLEND);
|
||||||
|
text->writeDX(TXT_COLOR | TXT_STROKE, 1, 1, caption, 1, textColor, 1, strokeColor);
|
||||||
|
|
||||||
|
// Crea el sprite
|
||||||
|
pressEnterSprite = new Sprite(128 - (pressEnterTexture->getWidth() / 2), 192 / 5 * 4, pressEnterTexture->getWidth(), pressEnterTexture->getHeight(), pressEnterTexture, renderer);
|
||||||
|
|
||||||
// Cambia el color del borde
|
// Cambia el color del borde
|
||||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
||||||
}
|
}
|
||||||
@@ -51,6 +65,8 @@ Title::~Title()
|
|||||||
{
|
{
|
||||||
delete eventHandler;
|
delete eventHandler;
|
||||||
delete sprite;
|
delete sprite;
|
||||||
|
delete pressEnterSprite;
|
||||||
|
delete pressEnterTexture;
|
||||||
delete text;
|
delete text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,18 +222,13 @@ void Title::render()
|
|||||||
// Prepara para empezar a dibujar en la textura de juego
|
// Prepara para empezar a dibujar en la textura de juego
|
||||||
screen->start();
|
screen->start();
|
||||||
|
|
||||||
// Limpia la pantalla
|
|
||||||
screen->clean();
|
|
||||||
|
|
||||||
// Dibuja el fondo del titulo
|
// Dibuja el fondo del titulo
|
||||||
sprite->render();
|
sprite->render();
|
||||||
|
|
||||||
// Dibuja el texto de PRESS ENTER TO PLAY
|
// Dibuja el texto de PRESS ENTER TO PLAY
|
||||||
if (counter % 80 < 60)
|
if (counter % 80 < 60)
|
||||||
{
|
{
|
||||||
const color_t textColor = stringToColor(options->palette, "white");
|
pressEnterSprite->render();
|
||||||
const color_t strokeColor = stringToColor(options->palette, "bright_blue");
|
|
||||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, 256 / 2, 192 / 5 * 4, "PRESS ENTER TO PLAY", 1, textColor, 1, strokeColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dibuja la marquesina
|
// Dibuja la marquesina
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ private:
|
|||||||
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
|
||||||
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
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
int counter; // Contador
|
int counter; // Contador
|
||||||
|
|||||||
Reference in New Issue
Block a user