fix iteration order when drawing nodes

Thu, 21 Mar 2024 23:01:09 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 21 Mar 2024 23:01:09 +0100
changeset 43
5a8c31904e44
parent 42
cc912686f663
child 44
b3da4096c607

fix iteration order when drawing nodes

src/scene.c file | annotate | diff | comparison | revisions
--- a/src/scene.c	Thu Mar 21 23:00:39 2024 +0100
+++ b/src/scene.c	Thu Mar 21 23:01:09 2024 +0100
@@ -49,6 +49,13 @@
     );
 }
 
+static CxTreeVisitor asc_scene_node_visitor(AscSceneNode *node) {
+    return cx_tree_visitor(node,
+            offsetof(AscSceneNode, children),
+            offsetof(AscSceneNode, next)
+    );
+}
+
 void asc_scene_init(AscScene *scene) {
     if (scene->root != NULL) {
         asc_error("Scene is already initialized.");
@@ -95,7 +102,7 @@
     scene->rg_sprites_blended_size = 0;
 
     // skip the root node deliberately, we know it's just the container
-    CxTreeIterator iter = asc_scene_node_iterator(scene->root, false);
+    CxTreeVisitor iter = asc_scene_node_visitor(scene->root);
     cxIteratorNext(iter);
 
     // update the children and add them to the render groups

mercurial