Could we add more detail to the Map class explaining how tile indexing works? It could be placed in the map header or within the GetTileIndex function.
I wanted to write a function that allows changing the map size dynamically, but to do that, I need to understand the indexing better.
// Helper method to handle complex tile data indexing
std::size_t Map::GetTileIndex(std::size_t x, std::size_t y) const
{
auto lowerX = x & 0x1F; // ... 0001 1111
auto upperX = x >> 5; // ... 1110 0000
return (upperX * heightInTiles + y) * 32 + lowerX;
}
Could we add more detail to the Map class explaining how tile indexing works? It could be placed in the map header or within the GetTileIndex function.
I wanted to write a function that allows changing the map size dynamically, but to do that, I need to understand the indexing better.