OK... So, I'm using sf::View to create a view of a graph. At present, I am able to zoom in and out and move the the view in all directions. Currently, the graph generates four nodes and the view is at the default,
Graph_Camera.reset(sf::FloatRect(0.0f, 0.0f, Window.getSize().x, Window.getSize().y));
Graph_Camera.setViewport(sf::FloatRect(0.0f, 0.0f, 1.0f, 1.0f));
How would I resize the view in such a way that when more nodes are added, the view zooms out to display all nodes that are initially out of bounds at default? Also, an important point to note is that the change in number of nodes is not dynamic. It is predetermined before the window is rendered.
I tried setSize() but it is not centering on the Window center. Here's what I did,
Graph_Camera.setSize(Node_List.size() * 200, Node_List.size() * 200);
Graph_Camera.setViewport(sf::FloatRect(0.0f, 0.0f, 1.0f, 1.0f));
Please help me on this. Thanks.