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
|
// Reserva memoria para los punteros
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer);
|
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"));
|
sprite = new AnimatedSprite(renderer, resource->getAnimation("shine.ani"));
|
||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
@@ -203,7 +202,7 @@ void Credits::fillTexture()
|
|||||||
SDL_RenderDrawPoint(renderer, i + 1, 7);
|
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_Rect rect = {0, 8, 256, 192};
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
SDL_RenderFillRect(renderer, &rect);
|
||||||
|
|
||||||
@@ -272,21 +271,20 @@ void Credits::render()
|
|||||||
screen->clean();
|
screen->clean();
|
||||||
|
|
||||||
if (counter < 1150)
|
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);
|
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 srcRect = {1, 0, 254, 190 - (offset * 2)};
|
||||||
SDL_RenderCopy(renderer, coverTexture, nullptr, &rect);
|
SDL_Rect dstRect = {1, offset * 2, 254, 190 - (offset * 2)};
|
||||||
|
SDL_RenderCopy(renderer, coverTexture, &srcRect, &dstRect);
|
||||||
|
|
||||||
// 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,8,std::to_string(counterEnabled));
|
|
||||||
|
|
||||||
// Vuelca el contenido del renderizador en pantalla
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
screen->blit();
|
screen->blit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ private:
|
|||||||
Text *text; // Objeto para escribir texto en pantalla
|
Text *text; // Objeto para escribir texto en pantalla
|
||||||
SDL_Texture *textTexture; // Textura para dibujar el texto
|
SDL_Texture *textTexture; // Textura para dibujar el texto
|
||||||
SDL_Texture *coverTexture; // Textura para cubrir 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
|
AnimatedSprite *sprite; // Sprite para el brillo del corazón
|
||||||
options_t *options; // Puntero a las opciones del juego
|
options_t *options; // Puntero a las opciones del juego
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user