From 8b290fdd0de857cf11a71c096fb390a50c3a7e7e Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Mon, 20 Oct 2025 08:07:58 -0500 Subject: [PATCH] Implement menu despawner --- client/src/ui.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/src/ui.rs b/client/src/ui.rs index bbade38..d569111 100644 --- a/client/src/ui.rs +++ b/client/src/ui.rs @@ -46,8 +46,16 @@ pub fn spawn_main_menu(mut commands: Commands) { }); } -pub fn despawn_main_menu(mut commands: Commands) { - warn!("->> ui.rs: despawn_main_menu() is not implemented."); +/// Despawns the main menu (which is assumed to be the top-most node) +/// +/// TODO: Add a marker component, but only in debug builds. A unit test can +/// assert this condition so I don't actually have to check it at runtime +/// on release builds. +pub fn despawn_main_menu( + mut commands: Commands, + top_node: Single, Without)>, +) { + commands.entity(top_node.into_inner()).despawn(); } /// The basic bundle for generic buttons.