change doc
All checks were successful
Rust Checks / checks (push) Successful in 3m41s
Rust Checks / checks (pull_request) Successful in 3m0s

This commit is contained in:
CoCo_Sol 2024-03-06 16:05:20 +01:00
parent b6cf164cdd
commit c556b39857

View file

@ -5,15 +5,15 @@ use bevy::sprite::Anchor;
use super::Tile; use super::Tile;
/// A component that represents a selected tile. /// A component that mark a tile as selected.
#[derive(Component)] #[derive(Component)]
pub struct SelectedTile; pub struct SelectedTile;
/// A component that represents the selection. /// A component that mark an entity as a selection.
#[derive(Component)] #[derive(Component)]
struct Selection; struct Selection;
/// A event that is triggered when a mouse button is clicked in the world. /// A event that is triggered when a mouse button is clicked.
/// ///
/// The event contains the position of the cursor in the world. /// The event contains the position of the cursor in the world.
#[derive(Event)] #[derive(Event)]
@ -31,7 +31,7 @@ impl Plugin for SelectorPlugin {
} }
} }
/// Handles the mouse click and gets the position of the cursor in the world.* /// Handles the mouse click and gets the position of the cursor in the world.
/// Finally, it sends an event with the position of the cursor. /// Finally, it sends an event with the position of the cursor.
fn mouse_handler( fn mouse_handler(
mouse_button_input: Res<Input<MouseButton>>, mouse_button_input: Res<Input<MouseButton>>,
@ -64,7 +64,7 @@ fn mouse_handler(
} }
/// Selects the closest tile to the cursor and marks it as selected. /// Selects the closest tile to the cursor and marks it as selected.
/// It also marks the old selection as unselected. /// It also unmarks the old selection if there is one.
fn select_closest_tile( fn select_closest_tile(
mut commands: Commands, mut commands: Commands,
tiles: Query<(Entity, &Transform, &Tile)>, tiles: Query<(Entity, &Transform, &Tile)>,