eliminat el punter al renderer de 50.000 llocs

This commit is contained in:
2024-07-28 10:45:14 +02:00
parent 7501b4936f
commit 2948684ad3
58 changed files with 492 additions and 401 deletions

View File

@@ -39,15 +39,15 @@ Background::Background(SDL_Renderer *renderer, Screen *screen, Asset *asset, par
const int clouds2y = base - 101;
const float clouds1speed = 0.1f;
const float clouds2speed = 0.05f;
clouds1A = new MovingSprite(0, clouds1y, rect.w, clouds1Texture->getHeight(), -clouds1speed, 0.0f, 0.0f, 0.0f, clouds1Texture, renderer);
clouds1B = new MovingSprite(rect.w, clouds1y, rect.w, clouds1Texture->getHeight(), -clouds1speed, 0.0f, 0.0f, 0.0f, clouds1Texture, renderer);
clouds1A = new MovingSprite(0, clouds1y, rect.w, clouds1Texture->getHeight(), -clouds1speed, 0.0f, 0.0f, 0.0f, clouds1Texture);
clouds1B = new MovingSprite(rect.w, clouds1y, rect.w, clouds1Texture->getHeight(), -clouds1speed, 0.0f, 0.0f, 0.0f, clouds1Texture);
clouds2A = new MovingSprite(0, clouds2y, rect.w, clouds2Texture->getHeight(), -clouds2speed, 0.0f, 0.0f, 0.0f, clouds2Texture, renderer);
clouds2B = new MovingSprite(rect.w, clouds2y, rect.w, clouds2Texture->getHeight(), -clouds2speed, 0.0f, 0.0f, 0.0f, clouds2Texture, renderer);
clouds2A = new MovingSprite(0, clouds2y, rect.w, clouds2Texture->getHeight(), -clouds2speed, 0.0f, 0.0f, 0.0f, clouds2Texture);
clouds2B = new MovingSprite(rect.w, clouds2y, rect.w, clouds2Texture->getHeight(), -clouds2speed, 0.0f, 0.0f, 0.0f, clouds2Texture);
buildingsSprite = new Sprite(0, 0, buildingsTexture->getWidth(), buildingsTexture->getHeight(), buildingsTexture, renderer);
gradientSprite = new Sprite(0, 0, rect.w, rect.h, gradientsTexture, renderer);
grassSprite = new Sprite(0, 0, grassTexture->getWidth(), grassTexture->getHeight() / 2, grassTexture, renderer);
buildingsSprite = new Sprite(0, 0, buildingsTexture->getWidth(), buildingsTexture->getHeight(), buildingsTexture);
gradientSprite = new Sprite(0, 0, rect.w, rect.h, gradientsTexture);
grassSprite = new Sprite(0, 0, grassTexture->getWidth(), grassTexture->getHeight() / 2, grassTexture);
// Inicializa objetos
clouds1A->setSpriteClip(0, 0, clouds1Texture->getWidth(), clouds1Texture->getHeight());