forked from jaildesigner-jailgames/jaildoctors_dilemma
Optimizada la textura que cubre los creditos
This commit is contained in:
@@ -13,7 +13,6 @@ Credits::Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Ass
|
||||
// Reserva memoria para los punteros
|
||||
eventHandler = new SDL_Event();
|
||||
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer);
|
||||
texture = resource->getTexture("shine.png");
|
||||
sprite = new AnimatedSprite(renderer, resource->getAnimation("shine.ani"));
|
||||
|
||||
// Inicializa variables
|
||||
@@ -203,7 +202,7 @@ void Credits::fillTexture()
|
||||
SDL_RenderDrawPoint(renderer, i + 1, 7);
|
||||
}
|
||||
|
||||
// El resto se rellena de color
|
||||
// El resto se rellena de color sólido
|
||||
SDL_Rect rect = {0, 8, 256, 192};
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
|
||||
@@ -272,21 +271,20 @@ void Credits::render()
|
||||
screen->clean();
|
||||
|
||||
if (counter < 1150)
|
||||
{ // Dibuja la textura con el texto en pantalla
|
||||
{
|
||||
// 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);
|
||||
SDL_Rect srcRect = {1, 0, 254, 190 - (offset * 2)};
|
||||
SDL_Rect dstRect = {1, offset * 2, 254, 190 - (offset * 2)};
|
||||
SDL_RenderCopy(renderer, coverTexture, &srcRect, &dstRect);
|
||||
|
||||
// Dibuja el sprite con el brillo
|
||||
sprite->render();
|
||||
}
|
||||
|
||||
// text->write(0,0,std::to_string(counter));
|
||||
// text->write(0,8,std::to_string(counterEnabled));
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user