summaryrefslogtreecommitdiff
path: root/src/quadtree.cpp
diff options
context:
space:
mode:
authormajortom6 <tombarrett@siu.edu>2017-02-19 08:06:37 -0600
committerTom Barrett <tombarrett@siu.edu>2017-03-07 13:23:41 -0600
commit2cc21176467d4501adb7bfb9ee03eb9a2a7d14f2 (patch)
treee12ceac7024bdc697f1ed4adc1a1ece4a82489fc /src/quadtree.cpp
parent74c6854fd8dcbaee736ac0421805ff1e03c4a1e2 (diff)
-removed all references to sdl_rect and location and now everything now uses our own class rectangle
-standardization of tab spaces to 8 is now in effect -refractoring of graphicsobjects.hpp
Diffstat (limited to 'src/quadtree.cpp')
-rw-r--r--src/quadtree.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/quadtree.cpp b/src/quadtree.cpp
index e347e55..9fd4f0c 100644
--- a/src/quadtree.cpp
+++ b/src/quadtree.cpp
@@ -13,7 +13,7 @@ Quadtree::Quadtree(int pLevel, Rectangle pBounds){
gfxDataRect.r = 255;
gfxDataRect.g = 0;
gfxDataRect.b = 255;
- gfxDataRect.sides = pBounds.height;
+ gfxDataRect.sides = pBounds.h;
}
void Quadtree::clear(){
@@ -31,10 +31,10 @@ void Quadtree::clear(){
}
void Quadtree::split(){
- float subWidth = (bounds.getWidth() / 2);
- float subHeight = (bounds.getHeight() / 2);
- float x = bounds.getX();
- float y = bounds.getY();
+ float subWidth = (bounds.w / 2);
+ float subHeight = (bounds.h / 2);
+ float x = bounds.x;
+ float y = bounds.y;
Rectangle R0(x + subWidth/2, y + subHeight/2, subWidth, subHeight);
@@ -57,16 +57,16 @@ void Quadtree::clear(){
int Quadtree::getIndex(GraphicsData object) {
int index = -1;
- bool topQuadrant = (object.getY() > bounds.getY());
- bool bottomQuadrant = (object.getY() < bounds.getY());
+ bool topQuadrant = (object.y > bounds.y);
+ bool bottomQuadrant = (object.y < bounds.y);
- if (object.getX() < bounds.getX()) {
+ if (object.x < bounds.x) {
if (topQuadrant)
index = 1;
else if (bottomQuadrant)
index = 2;
}
- else if (object.getX() > bounds.getX()) {
+ else if (object.x > bounds.x) {
if (topQuadrant)
index = 0;
else if (bottomQuadrant)