From bcb56e17f2c3b7f7d8100f9270eff9ecb2122aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Tue, 25 Oct 2022 18:32:00 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adido=20brillo=20a=20los=20creditos=20y?= =?UTF-8?q?=20cambiada=20la=20malla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/credits.cpp | 35 ++++++++++++++++++++--------------- source/director.cpp | 2 +- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/source/credits.cpp b/source/credits.cpp index 0934349..11ff1e4 100644 --- a/source/credits.cpp +++ b/source/credits.cpp @@ -22,7 +22,7 @@ Credits::Credits(SDL_Renderer *renderer, Screen *screen, Asset *asset) section.subsection = 0; ticks = 0; ticksSpeed = 15; - sprite->setRect({21 * 8, 15 * 8, 8, 8}); + sprite->setRect({194, 174, 8, 8}); // Cambia el color del borde screen->setBorderColor(stringToColor("black")); @@ -53,7 +53,7 @@ Credits::Credits(SDL_Renderer *renderer, Screen *screen, Asset *asset) texts.push_back({"", stringToColor("white")}); texts.push_back({"", stringToColor("white")}); - texts.push_back({"LOVE JAILGAMES!}", stringToColor("white")}); + texts.push_back({"I LOVE JAILGAMES!}", stringToColor("white")}); texts.push_back({"", stringToColor("white")}); // Crea la textura para el texto que se escribe en pantalla @@ -154,8 +154,8 @@ void Credits::fillTexture() SDL_RenderDrawPoint(renderer, i, 4); SDL_RenderDrawPoint(renderer, i, 6); - SDL_RenderDrawPoint(renderer, i + 1, 1); - SDL_RenderDrawPoint(renderer, i + 1, 3); + // SDL_RenderDrawPoint(renderer, i + 1, 1); + // SDL_RenderDrawPoint(renderer, i + 1, 3); SDL_RenderDrawPoint(renderer, i + 1, 5); SDL_RenderDrawPoint(renderer, i + 1, 7); } @@ -190,7 +190,7 @@ void Credits::updateCounter() } // Comprueba si ha terminado la sección - if (counter > 1000) + if (counter > 1200) { section.name = SECTION_PROG_DEMO; } @@ -212,7 +212,10 @@ void Credits::update() updateCounter(); // Actualiza el sprite con el brillo - sprite->update(); + if (counter > 770) + { + sprite->update(); + } } } @@ -225,19 +228,21 @@ void Credits::render() // Limpia la pantalla screen->clean(); - // Dibuja la textura con el texto en pantalla - SDL_RenderCopy(renderer, textTexture, nullptr, nullptr); + if (counter < 1150) + { // Dibuja la textura con el texto en pantalla + SDL_RenderCopy(renderer, textTexture, nullptr, nullptr); - // Dibuja la textura que cubre el texto - const int offset = std::min(counter / 8, 192 / 2); - SDL_Rect rect = {0, offset * 2, 256, 192}; - SDL_RenderCopy(renderer, coverTexture, nullptr, &rect); + // Dibuja la textura que cubre el texto + const int offset = std::min(counter / 8, 192 / 2); + SDL_Rect rect = {0, offset * 2, 256, 192}; + SDL_RenderCopy(renderer, coverTexture, nullptr, &rect); - // Dibuja el sprite con el brillo - sprite->render(); + // Dibuja el sprite con el brillo + sprite->render(); + } // text->write(0,0,std::to_string(counter)); - // text->write(0,8,std::to_string(counterEnabled)); + // text->write(0,8,std::to_string(counterEnabled)); // Vuelca el contenido del renderizador en pantalla screen->blit(); diff --git a/source/director.cpp b/source/director.cpp index 1eb8fdc..2b0f702 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -9,7 +9,7 @@ Director::Director(std::string path) section.name = SECTION_PROG_LOGO; section.subsection = SUBSECTION_LOGO_TO_INTRO; - section.name = SECTION_PROG_TITLE; + section.name = SECTION_PROG_CREDITS; // Crea el objeto que controla los ficheros de recursos asset = new Asset(path.substr(0, path.find_last_of("\\/")));