I'm using
tmxLoader by fallahn and my view rotates with the movement of the player. The issue is that some parts of the map are not drawn when rotating. It seems that the drawing only takes the size of the view without the rotation.
As you can see in attachment 1, when the player and the view are not rotated (or slightly) the maps draws correctly, and in attachment 2 you can see that when they are rotated part of the map is not drawn.
Before drawing this is being called (private method):
void MapLoader::SetDrawingBounds(const sf::View& view)
{
if(view.getCenter() != m_lastViewPos)
{
sf::FloatRect bounds;
bounds.left = view.getCenter().x - (view.getSize().x / 2.f);
bounds.top = view.getCenter().y - (view.getSize().y / 2.f);
bounds.width = view.getSize().x;
bounds.height = view.getSize().y;
//add a tile border to prevent gaps appearing
bounds.left -= static_cast<float>(m_tileWidth);
bounds.top -= static_cast<float>(m_tileHeight);
bounds.width += static_cast<float>(m_tileWidth * 2);
bounds.height += static_cast<float>(m_tileHeight * 2);
m_bounds = bounds;
for(auto& layer : m_layers)
layer.Cull(m_bounds);
}
m_lastViewPos = view.getCenter();
}
Do I need to change tmxLoader myself or is there a way to set it up manually outside MapLoader?
And how do I need to change it?
Note: I didn't want to post in the tmxLoader specific Topic since is been inactive for 4 years now.