Skip to content

Commit 0cb7112

Browse files
authored
Merge pull request #164 from CppJavaCoder/patch-1
Update MapLayer.cpp Fix u v
2 parents 89eaddc + 5d8735a commit 0cb7112

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

SDL2Example/src/MapLayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ bool MapLayer::create(const tmx::Map& map, std::uint32_t layerIndex, const std::
8282
//tex coords
8383
auto idIndex = (tileIDs[idx].ID - ts.getFirstGID());
8484
float u = static_cast<float>(idIndex % tileCountX);
85-
float v = static_cast<float>(idIndex / tileCountY);
85+
float v = static_cast<float>(idIndex / tileCountX);
8686
u *= mapTileSize.x; //TODO we should be using the tile set size, as this may be different from the map's grid size
8787
v *= mapTileSize.y;
8888

@@ -131,4 +131,4 @@ void MapLayer::draw(SDL_Renderer* renderer) const
131131
{
132132
SDL_RenderGeometry(renderer, s.texture, s.vertexData.data(), static_cast<std::int32_t>(s.vertexData.size()), nullptr, 0);
133133
}
134-
}
134+
}

0 commit comments

Comments
 (0)