Cambiado el nombre a una variable
This commit is contained in:
@@ -185,6 +185,7 @@ void Map::fillMapTexture()
|
|||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
|
|
||||||
const int tile_size = 16;
|
const int tile_size = 16;
|
||||||
|
const int tileset_width_in_tiles = 16;
|
||||||
const int map_width_in_tiles = 20;
|
const int map_width_in_tiles = 20;
|
||||||
const int map_height_in_tiles = 13;
|
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 y = 0; y < map_height_in_tiles; y++)
|
||||||
for (int x = 0; x < map_width_in_tiles; x++)
|
for (int x = 0; x < map_width_in_tiles; x++)
|
||||||
{
|
{
|
||||||
clip.x = ((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) / 16) * 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);
|
texture_tile->render(renderer, x * tile_size, y * tile_size, &clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user