Ya sale de la demo con cualquier tecla

This commit is contained in:
2022-10-24 21:54:57 +02:00
parent 38c18ae676
commit fa6d73f7f4
3 changed files with 23 additions and 9 deletions

View File

@@ -72,10 +72,14 @@ void Text::writeDX(Uint8 flags, int x, int y, std::string text, int kerning, col
const bool stroked = ((flags & TXT_STROKE) == TXT_STROKE);
if (centered)
{
x -= (Text::lenght(text, kerning) / 2);
}
if (shadowed)
{
writeColored(x + shadowDistance, y + shadowDistance, text, shadowColor, kerning, lenght);
}
if (stroked)
{
@@ -91,10 +95,14 @@ void Text::writeDX(Uint8 flags, int x, int y, std::string text, int kerning, col
}
if (colored)
{
writeColored(x, y, text, textColor, kerning, lenght);
}
else
{
write(x, y, text, kerning, lenght);
}
}
// Obtiene la longitud en pixels de una cadena
int Text::lenght(std::string text, int kerning)

View File

@@ -154,9 +154,6 @@ void Demo::render()
scoreboard->render();
screen->renderFX();
//text->write(0, 0, std::to_string(counter));
text->write(0, 0, std::to_string(section.name));
// Actualiza la pantalla
screen->blit();
}

View File

@@ -21,7 +21,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Asset *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 P.A.C.O. THAT WILL BLOW YOUR MIND WITH JAILGAMES ON THE GO. 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!!";
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;
@@ -135,7 +135,7 @@ void Title::renderMarquee()
if (l.enabled)
{
// text->writeColored(l.x, 176, l.letter, {0, 0, 0});
text->write(l.x, 176, l.letter);
text->write(l.x, 184, l.letter);
}
}
}
@@ -180,11 +180,20 @@ void Title::render()
sprite->render();
// Dibuja el texto de PRESS ENTER TO PLAY
SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
SDL_Rect rect = {0, 192 / 5 * 4, 256, 8};
SDL_RenderFillRect(renderer, &rect);
// SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
// const SDL_Rect rect = {0, 192 / 5 * 4, 256, 8};
// SDL_RenderFillRect(renderer, &rect);
// if (counter % 80 < 60)
//{
// text->writeCentered(256 / 2, 192 / 5 * 4, "PRESS ENTER TO PLAY");
//}
if (counter % 80 < 60)
text->writeCentered(256 / 2, 192 / 5 * 4, "PRESS ENTER TO PLAY");
{
const color_t textColor = stringToColor("white");
const color_t strokeColor = stringToColor("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
renderMarquee();