Trabajando en la carga de menus desde fichero

This commit is contained in:
2022-08-28 19:59:03 +02:00
parent d9cb7f68e2
commit d5a069b8db
9 changed files with 352 additions and 53 deletions

View File

@@ -365,6 +365,9 @@ void Map::fillMapTexture()
for (int y = 0; y < map_height; y++)
for (int x = 0; x < map_width; x++)
{
// Resta uno porque Tiled almacena los indices empezando de 1 en vez de 0.
// El problema es que los tiles vacios los pone como 0 y aqui pasan a ser -1
// con lo que esta pintando desde fuera de la textura
clip.x = ((tilemap[(y * map_width) + x] - 1) % tileset_width) * tile_size;
clip.y = ((tilemap[(y * map_width) + x] - 1) / tileset_width) * tile_size;
texture_tile->render(renderer, x * tile_size, y * tile_size, &clip);