Commit pa que Mon arregle el codi mentre em dutxe

This commit is contained in:
2024-10-09 21:48:01 +02:00
parent 3c1dcad3ab
commit f2fa216b0d
34 changed files with 862 additions and 1218 deletions

View File

@@ -58,16 +58,16 @@ void Tiledbg::init()
void Tiledbg::fillTexture()
{
// Crea los objetos para pintar en la textura de fondo
Texture *bgTileTexture = new Texture(renderer, texturePath);
Sprite *tile = new Sprite({0, 0, tileWidth, tileHeight}, bgTileTexture);
auto bgTileTexture = std::make_shared<Texture>(renderer, texturePath);
auto tile = std::make_unique<Sprite>((SDL_Rect){0, 0, tileWidth, tileHeight}, bgTileTexture);
// Prepara para dibujar sobre la textura
SDL_Texture *temp = SDL_GetRenderTarget(renderer);
auto temp = SDL_GetRenderTarget(renderer);
SDL_SetRenderTarget(renderer, canvas);
// Rellena la textura con el tile
const int iMax = pos.w * 2 / tileWidth;
const int jMax = pos.h * 2 / tileHeight;
const auto iMax = pos.w * 2 / tileWidth;
const auto jMax = pos.h * 2 / tileHeight;
tile->setSpriteClip(0, 0, tileWidth, tileHeight);
for (int i = 0; i < iMax; ++i)
{
@@ -84,8 +84,6 @@ void Tiledbg::fillTexture()
// Libera la memoria utilizada por los objetos
bgTileTexture->unload();
delete bgTileTexture;
delete tile;
}
// Pinta la clase en pantalla