From fcd9cf3b79669455959a4c02369702cf428c88e3 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 11 Aug 2022 21:16:00 +0200 Subject: [PATCH] Cambiado el nombre a una variable --- source/map.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/map.cpp b/source/map.cpp index 7d9596a..efcb211 100644 --- a/source/map.cpp +++ b/source/map.cpp @@ -185,6 +185,7 @@ void Map::fillMapTexture() SDL_RenderClear(renderer); const int tile_size = 16; + const int tileset_width_in_tiles = 16; const int map_width_in_tiles = 20; const int map_height_in_tiles = 13; @@ -193,8 +194,8 @@ void Map::fillMapTexture() for (int y = 0; y < map_height_in_tiles; y++) for (int x = 0; x < map_width_in_tiles; x++) { - clip.x = ((tilemap[(y * map_width_in_tiles) + x] - 1) % 16) * tile_size; - clip.y = ((tilemap[(y * map_width_in_tiles) + x] - 1) / 16) * tile_size; + clip.x = ((tilemap[(y * map_width_in_tiles) + x] - 1) % tileset_width_in_tiles) * tile_size; + clip.y = ((tilemap[(y * map_width_in_tiles) + x] - 1) / tileset_width_in_tiles) * tile_size; texture_tile->render(renderer, x * tile_size, y * tile_size, &clip); }