From d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Mon, 21 Dec 2020 01:22:15 +0100 Subject: Add previously missing docs where appropriate --- src/map/icon.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/map/icon.rs') diff --git a/src/map/icon.rs b/src/map/icon.rs index f623c98..2e45486 100644 --- a/src/map/icon.rs +++ b/src/map/icon.rs @@ -1,3 +1,6 @@ +//! Icons are map elements that have a specific size and cannot be stretched. They are usually used +//! as markers for specific places in the world. + use super::icon_renderer::IconRenderer; use crate::colours::DEFAULT_COLOURS; use crate::map::Mappable; @@ -8,6 +11,7 @@ use serde::{Deserialize, Serialize}; use std::ops::{Deref, DerefMut}; use std::rc::Rc; +/// The icon data necessary to create an Icon again. #[derive(Clone, Serialize, Deserialize)] pub struct IconData { /// The id of the icon is the icons position in the currently loaded icon_data vector. @@ -18,6 +22,7 @@ pub struct IconData { pub rotation: f64, } +/// Describes an icon in the world and can be drawn. #[derive(Clone)] pub struct Icon { data: IconData, @@ -26,6 +31,8 @@ pub struct Icon { } impl Icon { + /// Create a new icon. Requires the icon renderer that is used to render this icon, as well as all + /// the information necessary to describe the icon itself. pub fn new(id: usize, position: Vec2, rotation: f64, renderer: Rc) -> Self { Self::from_data( IconData { @@ -37,6 +44,7 @@ impl Icon { ) } + /// Like `new()`, but with the icon data bundled into the icon data type. pub fn from_data(data: IconData, renderer: Rc) -> Self { Self { data, -- cgit v1.2.3-70-g09d2