diff --git a/source/credits.cpp b/source/credits.cpp index 64303bb..588d83a 100644 --- a/source/credits.cpp +++ b/source/credits.cpp @@ -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(); } diff --git a/source/credits.h b/source/credits.h index d12ecc7..ad86bfc 100644 --- a/source/credits.h +++ b/source/credits.h @@ -34,7 +34,6 @@ private: Text *text; // Objeto para escribir texto en pantalla SDL_Texture *textTexture; // Textura para dibujar el texto SDL_Texture *coverTexture; // Textura para cubrir el texto - Texture *texture; // Textura para el sprite de brillo AnimatedSprite *sprite; // Sprite para el brillo del corazón options_t *options; // Puntero a las opciones del juego