--- a/demo/snake/snake.c Thu Oct 09 19:03:32 2025 +0200 +++ b/demo/snake/snake.c Thu Oct 09 19:15:02 2025 +0200 @@ -192,9 +192,7 @@ } static void game_over_text_keep_centered(AscBehavior *behavior) { - if (!asc_active_window->resized) return; - - // TODO: if we could react on some sort of "unhidden" event, we could pause this behavior while hidden + if (!behavior->unpaused && !asc_active_window->resized) return; AscSceneNode *node = behavior->node; // center the "game over" text in the game field viewport @@ -207,16 +205,16 @@ static AscSceneNode *game_over_create_text(void) { AscSceneNode *node = asc_text( - .name = "game_over_text", - .text = "Game Over\nPress R to Restart", - .color = ASC_RGB(1, 1, 1), - .font = asc_font(ASC_FONT_REGULAR, 36), - .alignment = ASC_TEXT_ALIGN_CENTER, - .centered = true, - ); + .name = "game_over_text", + .text = "Game Over\nPress R to Restart", + .color = ASC_RGB(1, 1, 1), + .font = asc_font(ASC_FONT_REGULAR, 36), + .alignment = ASC_TEXT_ALIGN_CENTER, + .centered = true, + ); asc_scene_node_hide(node); - asc_behavior_add(node, game_over_text_keep_centered); + asc_behavior_add(node, game_over_text_keep_centered, .pause_while_hidden = true); asc_ui_add_node(node); return node;