aboutsummaryrefslogtreecommitdiff
path: root/ViewController.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-21 17:41:38 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-21 17:41:38 +0200
commit90652f512e9621e0dfac497439c7c80bf113d9d5 (patch)
treecff62ca951edd2f59b8a9970e534b05a78c9d1f5 /ViewController.cpp
parente8601b35b601b0ee1486dfaa12385e71b7f2b300 (diff)
implement quadtree paritioning
Diffstat (limited to 'ViewController.cpp')
-rw-r--r--ViewController.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/ViewController.cpp b/ViewController.cpp
index d336b9c..3b298db 100644
--- a/ViewController.cpp
+++ b/ViewController.cpp
@@ -70,13 +70,14 @@ void ViewController::update_pathfinding() {
void ViewController::update_quadtree_recursive(QuadTree * tree) {
if (tree == nullptr) return;
+ const Rectangle & tree_boundary = tree->get_boundary();
Rectangle rect = {
- .x = tree->boundary.x * scale,
- .y = tree->boundary.y * scale,
- .width = tree->boundary.width * scale,
- .height = tree->boundary.height * scale,
+ .x = tree_boundary.x * scale,
+ .y = tree_boundary.y * scale,
+ .width = tree_boundary.width * scale,
+ .height = tree_boundary.height * scale,
};
- this->view.draw_rect(rect, { .red = 0xff, .green = 0x00, .blue = 0xff, }, 2);
+ this->view.draw_rect(rect, { .red = 0xff, .green = 0x00, .blue = 0xff, }, 1);
this->update_quadtree_recursive(tree->subtree[0].get());
this->update_quadtree_recursive(tree->subtree[1].get());