Optimizado un poco el title.cpp

This commit is contained in:
2022-11-30 13:43:47 +01:00
parent 75228cc451
commit 5d89a3057e
4 changed files with 25 additions and 14 deletions

View File

@@ -30,7 +30,6 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
ticks = 0;
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!!!";
for (int i = 0; i < (int)longText.length(); ++i)
{
letter_t l;
@@ -42,6 +41,21 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
letters[0].enabled = true;
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
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
}
@@ -51,6 +65,8 @@ Title::~Title()
{
delete eventHandler;
delete sprite;
delete pressEnterSprite;
delete pressEnterTexture;
delete text;
}
@@ -206,18 +222,13 @@ void Title::render()
// Prepara para empezar a dibujar en la textura de juego
screen->start();
// Limpia la pantalla
screen->clean();
// Dibuja el fondo del titulo
sprite->render();
// Dibuja el texto de PRESS ENTER TO PLAY
if (counter % 80 < 60)
{
const color_t textColor = stringToColor(options->palette, "white");
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);
pressEnterSprite->render();
}
// Dibuja la marquesina