summaryrefslogtreecommitdiff
path: root/inc/quadtree.hpp
blob: bf308f86f12a8a48b4273ac288b1bcb999f2ee1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef quadtree_h
#define quadtree_h

#include <vector>

#include "constants.hpp"
#include "creature.hpp"
#include "resource.hpp"
#include "entity.hpp"
#include "rectangle.hpp"

#include "opengl/graphicsdata.hpp"
#include "sdl/window.hpp"

class Quadtree {
        public:
                Quadtree();
                Quadtree(int pLevel,Rectangle pBounds);

                void clear();
                void insert(Entity* iter);

                std::vector<Entity*> retrieve(std::vector<Entity*> returnObject, GraphicsData obj);
                std::vector<Entity*> objects;

                Quadtree* nodes;

                std::vector<GraphicsData> Draw();

        private:
                void    split();
                int     getIndex(GraphicsData object);
                int     level;
                bool    isNull = true;

                GraphicsData gfxDataRect;
                Rectangle bounds;
};

#endif