Añadido el objeto background al titulo

This commit is contained in:
2024-06-04 13:50:35 +02:00
parent e4c14b275f
commit 96d19599cd
9 changed files with 50 additions and 11 deletions

View File

@@ -15,7 +15,6 @@ Background::Background(SDL_Renderer *renderer, Screen *screen, Asset *asset)
transition = 0;
counter = 0;
rect = {0, 0, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT};
srcRect = {0, rect.h - playArea.h, playArea.w, playArea.h};
srcRect = {playArea.x, rect.h - playArea.h, playArea.w, playArea.h};
dstRect = {0, 0, playArea.w, playArea.h};
base = rect.h;
@@ -200,4 +199,16 @@ void Background::setPos(SDL_Rect rect)
// Si cambian las medidas del destino, hay que cambiar las del origen para evitar deformar la imagen
srcRect.w = rect.w;
srcRect.h = rect.h;
}
// Ajusta el valor de la variable
void Background::setSrcDest(SDL_Rect value)
{
srcRect = value;
}
// Ajusta el valor de la variable
void Background::setDstDest(SDL_Rect value)
{
dstRect = value;
}