Search code examples
c++screensfmlboundsquadtree

Quadtree and size of region in constructor


I was reading nice tutorial about Quadtree from this site and now is my question.

When I create quadtree I have to pass in constructor bounds of the screen, well What if my map's size 10000 x 10000px and game screen is 1280 x 720px, what should I pass?

Quadtree quad = new Quadtree(0, new Rectangle(0,0,600,600));

So in this example the screen region is just 600 x 600px. And it's working perfectly until player will go further than 600x600

I'm using c++ SFML 2.0, where sf::View is center to player position.


Solution

  • You should pass the bounds of the whole map, regardless of whether parts of the region can be seen or not.