From 74c6854fd8dcbaee736ac0421805ff1e03c4a1e2 Mon Sep 17 00:00:00 2001 From: iamn1ck Date: Sun, 19 Feb 2017 07:00:34 -0600 Subject: -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 --- inc/quadtree.hpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 inc/quadtree.hpp (limited to 'inc/quadtree.hpp') 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 +#include + +#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 retrieve(std::list returnObject, GraphicsData obj); + + std::list objects; + + Quadtree* nodes; + + std::vector 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 -- cgit v1.2.3