Skip to content

Commit

Permalink
add more doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
maxomatic458 committed Oct 12, 2024
1 parent 5f10a8e commit 9073525
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/item_menu.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9073525

Please sign in to comment.