# HG changeset patch # User Mike Becker # Date 1754679074 -7200 # Node ID 1315ac4d1368ea235185a4018922c1b7bcf72b35 # Parent 9ef9f90eea5544baf2660def7120775aa3b4ba37 add show/hide functions for scene nodes diff -r 9ef9f90eea55 -r 1315ac4d1368 src/ascension/scene_node.h --- a/src/ascension/scene_node.h Fri Aug 08 20:51:02 2025 +0200 +++ b/src/ascension/scene_node.h Fri Aug 08 20:51:14 2025 +0200 @@ -315,4 +315,20 @@ asc_scene_node_update_transform(node); } +static inline void asc_scene_node_hide(AscSceneNode *node) { + asc_set_flag(node->flags, ASC_SCENE_NODE_HIDDEN); +} + +static inline void asc_scene_node_show(AscSceneNode *node) { + asc_clear_flag(node->flags, ASC_SCENE_NODE_HIDDEN); +} + +static inline void asc_scene_node_toggle_visibility(AscSceneNode *node) { + asc_toggle_flag(node->flags, ASC_SCENE_NODE_HIDDEN); +} + +static inline bool asc_scene_node_is_hidden(AscSceneNode *node) { + return asc_test_flag(node->flags, ASC_SCENE_NODE_HIDDEN); +} + #endif diff -r 9ef9f90eea55 -r 1315ac4d1368 src/scene.c --- a/src/scene.c Fri Aug 08 20:51:02 2025 +0200 +++ b/src/scene.c Fri Aug 08 20:51:14 2025 +0200 @@ -152,7 +152,7 @@ ); cx_foreach(AscSceneNode*, node, iter) { // skip hidden nodes (and all their children) - if (asc_test_flag(node->flags, ASC_SCENE_NODE_HIDDEN)) { + if (asc_scene_node_is_hidden(node)) { cxTreeVisitorContinue(iter); } diff -r 9ef9f90eea55 -r 1315ac4d1368 src/text.c --- a/src/text.c Fri Aug 08 20:51:02 2025 +0200 +++ b/src/text.c Fri Aug 08 20:51:14 2025 +0200 @@ -63,7 +63,7 @@ TTF_Font *font = asc_font_load(text->font); if (font == NULL) { // cannot load font - hide the text node to avoid errors when trying to draw - asc_set_flag(node->flags, ASC_SCENE_NODE_HIDDEN); + asc_scene_node_hide(node); return; } static TTF_HorizontalAlignment alignments[] = {