summaryrefslogtreecommitdiff
path: root/inc/quadtree.hpp
blob: fab20dabbc31d5259e22c545b4537c7d507bd738 (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
41
#ifndef quadtree_h
#define quadtree_h

#include <list>
#include <vector>

#include "window.hpp"
#include "creature.hpp"
#include "resource.hpp"
#include "entity.hpp"
#include "rectangle.hpp"
#include "graphicsobjects.hpp"

class Quadtree {

  public:
    Quadtree();
    Quadtree(int pLevel, Rectangle pBounds);
    void clear();
    void insert(Entity* iter);
    std::list<Entity*> retrieve(std::list<Entity*> returnObject, GraphicsData obj);

    std::list<Entity*> objects;

	Quadtree* nodes;

	std::vector<GraphicsData> Draw();
	
  private:
    void split();
    int getIndex(GraphicsData object);
    int MAX_OBJECTS = 5;
    int MAX_LEVELS = 6;
    int level;
	bool isNull = true;
	
	GraphicsData gfxDataRect;
    Rectangle bounds;
};

#endif