make hidden flag a general attribute of nodes

Wed, 10 Apr 2024 19:31:26 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 10 Apr 2024 19:31:26 +0200
changeset 55
6b61b4899587
parent 54
cb94d983e3dd
child 56
428fbb8355eb

make hidden flag a general attribute of nodes

src/ascension/scene.h file | annotate | diff | comparison | revisions
src/ascension/ui/text.h file | annotate | diff | comparison | revisions
src/scene.c file | annotate | diff | comparison | revisions
--- a/src/ascension/scene.h	Wed Apr 10 19:29:09 2024 +0200
+++ b/src/ascension/scene.h	Wed Apr 10 19:31:26 2024 +0200
@@ -62,6 +62,7 @@
     asc_transform transform;
     asc_transform world_transform;
     enum AscRenderGroup render_group;
+    bool hidden;
     bool need_graphics_update;
     bool need_transform_update;
 };
--- a/src/ascension/ui/text.h	Wed Apr 10 19:29:09 2024 +0200
+++ b/src/ascension/ui/text.h	Wed Apr 10 19:31:26 2024 +0200
@@ -38,7 +38,6 @@
     AscFont const *font;
     asc_col4i color;
     unsigned max_width;
-    bool hidden;
     bool centered;
     AscTexture tex;
 } AscText;
--- a/src/scene.c	Wed Apr 10 19:29:09 2024 +0200
+++ b/src/scene.c	Wed Apr 10 19:31:26 2024 +0200
@@ -83,6 +83,11 @@
     cx_foreach(AscSceneNode*, node, iter) {
         node->depth = iter.depth;
 
+        // skip hidden nodes (and all their children)
+        if (node->hidden) {
+            cxTreeVisitorContinue(iter);
+        }
+
         // execute behaviors, first
         if (node->behaviors != NULL) {
             CxIterator behavior_iter = cxListIterator(node->behaviors);

mercurial