Thu, 21 Mar 2024 23:01:09 +0100
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