summaryrefslogtreecommitdiff
path: root/inc/quadtree.hpp
diff options
context:
space:
mode:
authoriamn1ck <iamn1ck@yahoo.com>2017-02-19 07:00:34 -0600
committerTom Barrett <tombarrett@siu.edu>2017-03-07 13:22:46 -0600
commit74c6854fd8dcbaee736ac0421805ff1e03c4a1e2 (patch)
tree4a3ae40bea9b07a2111128e98d9272bdbac2af87 /inc/quadtree.hpp
parent03885192b9ff7d3c5e2dcfd98aefd21e9b62f603 (diff)
-quadtree and opengl rendering are now in the master branch !
-using sdl_rect for location and size ended up being not so great due to it not having floats, so we reverted back to using location -much, much refractoring is now needed
Diffstat (limited to 'inc/quadtree.hpp')
-rw-r--r--inc/quadtree.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/inc/quadtree.hpp b/inc/quadtree.hpp
new file mode 100644
index 0000000..2c23c67
--- /dev/null
+++ b/inc/quadtree.hpp
@@ -0,0 +1,40 @@
+#ifndef quadtree_h
+#define quadtree_h
+
+#include <list>
+#include <vector>
+
+#include "window.hpp"
+#include "creature.hpp"
+#include "resource.hpp"
+#include "entity.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