diff --git a/SDL2Example/src/MapLayer.cpp b/SDL2Example/src/MapLayer.cpp index 6594e6e..f2e07f9 100644 --- a/SDL2Example/src/MapLayer.cpp +++ b/SDL2Example/src/MapLayer.cpp @@ -82,7 +82,7 @@ bool MapLayer::create(const tmx::Map& map, std::uint32_t layerIndex, const std:: //tex coords auto idIndex = (tileIDs[idx].ID - ts.getFirstGID()); float u = static_cast(idIndex % tileCountX); - float v = static_cast(idIndex / tileCountY); + float v = static_cast(idIndex / tileCountX); u *= mapTileSize.x; //TODO we should be using the tile set size, as this may be different from the map's grid size v *= mapTileSize.y; @@ -131,4 +131,4 @@ void MapLayer::draw(SDL_Renderer* renderer) const { SDL_RenderGeometry(renderer, s.texture, s.vertexData.data(), static_cast(s.vertexData.size()), nullptr, 0); } -} \ No newline at end of file +}