diff options
Diffstat (limited to 'src/map/icon.rs')
| -rw-r--r-- | src/map/icon.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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<f64>, rotation: f64, renderer: Rc<IconRenderer>) -> 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<IconRenderer>) -> Self { Self { data, |
