Añadido brillo a los creditos y cambiada la malla

This commit is contained in:
2022-10-25 18:32:00 +02:00
parent 40368386e0
commit bcb56e17f2
2 changed files with 21 additions and 16 deletions

View File

@@ -22,7 +22,7 @@ Credits::Credits(SDL_Renderer *renderer, Screen *screen, Asset *asset)
section.subsection = 0; section.subsection = 0;
ticks = 0; ticks = 0;
ticksSpeed = 15; ticksSpeed = 15;
sprite->setRect({21 * 8, 15 * 8, 8, 8}); sprite->setRect({194, 174, 8, 8});
// Cambia el color del borde // Cambia el color del borde
screen->setBorderColor(stringToColor("black")); 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({"", 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")}); texts.push_back({"", stringToColor("white")});
// Crea la textura para el texto que se escribe en pantalla // 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, 4);
SDL_RenderDrawPoint(renderer, i, 6); SDL_RenderDrawPoint(renderer, i, 6);
SDL_RenderDrawPoint(renderer, i + 1, 1); // SDL_RenderDrawPoint(renderer, i + 1, 1);
SDL_RenderDrawPoint(renderer, i + 1, 3); // SDL_RenderDrawPoint(renderer, i + 1, 3);
SDL_RenderDrawPoint(renderer, i + 1, 5); SDL_RenderDrawPoint(renderer, i + 1, 5);
SDL_RenderDrawPoint(renderer, i + 1, 7); SDL_RenderDrawPoint(renderer, i + 1, 7);
} }
@@ -190,7 +190,7 @@ void Credits::updateCounter()
} }
// Comprueba si ha terminado la sección // Comprueba si ha terminado la sección
if (counter > 1000) if (counter > 1200)
{ {
section.name = SECTION_PROG_DEMO; section.name = SECTION_PROG_DEMO;
} }
@@ -212,7 +212,10 @@ void Credits::update()
updateCounter(); updateCounter();
// Actualiza el sprite con el brillo // Actualiza el sprite con el brillo
sprite->update(); if (counter > 770)
{
sprite->update();
}
} }
} }
@@ -225,19 +228,21 @@ void Credits::render()
// Limpia la pantalla // Limpia la pantalla
screen->clean(); screen->clean();
// Dibuja la textura con el texto en pantalla if (counter < 1150)
SDL_RenderCopy(renderer, textTexture, nullptr, nullptr); { // Dibuja la textura con el texto en pantalla
SDL_RenderCopy(renderer, textTexture, nullptr, nullptr);
// Dibuja la textura que cubre el texto // Dibuja la textura que cubre el texto
const int offset = std::min(counter / 8, 192 / 2); const int offset = std::min(counter / 8, 192 / 2);
SDL_Rect rect = {0, offset * 2, 256, 192}; SDL_Rect rect = {0, offset * 2, 256, 192};
SDL_RenderCopy(renderer, coverTexture, nullptr, &rect); SDL_RenderCopy(renderer, coverTexture, nullptr, &rect);
// Dibuja el sprite con el brillo // Dibuja el sprite con el brillo
sprite->render(); sprite->render();
}
// text->write(0,0,std::to_string(counter)); // 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 // Vuelca el contenido del renderizador en pantalla
screen->blit(); screen->blit();

View File

@@ -9,7 +9,7 @@ Director::Director(std::string path)
section.name = SECTION_PROG_LOGO; section.name = SECTION_PROG_LOGO;
section.subsection = SUBSECTION_LOGO_TO_INTRO; 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 // Crea el objeto que controla los ficheros de recursos
asset = new Asset(path.substr(0, path.find_last_of("\\/"))); asset = new Asset(path.substr(0, path.find_last_of("\\/")));