From fa6d73f7f4a29d03c560affed62458bfd99ffd4c Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Mon, 24 Oct 2022 21:54:57 +0200 Subject: [PATCH] Ya sale de la demo con cualquier tecla --- source/common/text.cpp | 8 ++++++++ source/demo.cpp | 3 --- source/title.cpp | 21 +++++++++++++++------ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/source/common/text.cpp b/source/common/text.cpp index 8ff51eb..d423094 100644 --- a/source/common/text.cpp +++ b/source/common/text.cpp @@ -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,9 +95,13 @@ 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 diff --git a/source/demo.cpp b/source/demo.cpp index b6bf2b3..abc82b9 100644 --- a/source/demo.cpp +++ b/source/demo.cpp @@ -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(); } diff --git a/source/title.cpp b/source/title.cpp index a94b656..03d42f9 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -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();