From 90735250a7fcff6d840c9d89d3bd41c64968686a Mon Sep 17 00:00:00 2001 From: maxomatic458 <104733404+maxomatic458@users.noreply.github.com> Date: Sat, 12 Oct 2024 11:19:11 +0200 Subject: [PATCH] add more doc comments --- examples/item_menu.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/item_menu.rs b/examples/item_menu.rs index 0bf3a9541..b4d58eebf 100644 --- a/examples/item_menu.rs +++ b/examples/item_menu.rs @@ -1,3 +1,7 @@ +//! This example shows how to use a read-only [`OpenInventory`] as a menu, +//! in which the player is able to select items by clicking on them. +//! This is commonly used on minigame servers (e.g for team selection). + #![allow(clippy::type_complexity)] const SPAWN_Y: i32 = 64; @@ -152,6 +156,7 @@ mod item_menu { } } + /// This event is fired when the player interacts with an item in the menu. #[derive(Debug, Clone, PartialEq, Eq, Event)] pub(crate) struct MenuItemSelectEvent { /// Player entity @@ -160,6 +165,9 @@ mod item_menu { pub idx: u16, } + /// The [`ItemMenu`] is a component, so it will open up once you attach it + /// to a player and it will close once you remove it from the player (or + /// in this implementation also if the player closes it). #[derive(Debug, Clone, Component)] pub(crate) struct ItemMenu { /// Item menu