Link to source used:
https://github.com/Hapaxia/SelbaWard/wiki/Tile-Map
My tilemap code:
//TileMap Stuff
Tiles = ENG::TextureFromFile(&MainWindow, "Data//Images//tileMap.png", "main", false, false, true);
for (auto& tile : levelData) { tile = rand() % 3; } // pick one of the four available tiles at "random"
tileMap.setLevel(levelData); // connect level data
tileMap.setLevelWidth(Engine::windowSize.x); // width of 125 means that the level data gets processed as if it is 125 x 80
tileMap.setSize({ 1280, 720 }); // size of tile map's rendered image
tileMap.setGridSize({ 40, 24 }); // size of tile map grid (number of tiles)
tileMap.setTexture(Tiles);
tileMap.setNumberOfTextureTilesPerRow(3);
tileMap.setTextureTileSize({ 64, 64 }); // actual size of tiles within the texture
tileMap.setPosition(MainWindow.mapPixelToCoords(Vector2i(0, 0)));
tileMap.update();
window->draw(tileMap);
//TileMap Stuff
what it draws:
https://i.imgur.com/LZiFJgB.png
it only randomly selects the first 7 rows
my tilemap:
https://imgur.com/a/lKJk3SX
I'm not understanding what setSize & setGridSize & setLevelWidth do.