diff options
Diffstat (limited to 'src/world/icon.rs')
| -rw-r--r-- | src/world/icon.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/world/icon.rs b/src/world/icon.rs new file mode 100644 index 0000000..c8945fb --- /dev/null +++ b/src/world/icon.rs @@ -0,0 +1,23 @@ +//! Icons are world elements that have a specific size and cannot be stretched. They are usually used +//! as markers for specific places in the world. + +use super::Component; +use crate::math::{Rect, Vec2}; +use serde::{Deserialize, Serialize}; + +/// The icon datatype. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Icon { + /// The id of the icon is the icons position in the currently loaded icon_data vector. + pub id: usize, + /// The position of the icon on the map, given by the vector in meters. + pub position: Vec2<f64>, + /// Rotation of the icon texture in degrees. + pub rotation: f64, +} + +impl Component for Icon { + fn bounding_rect(&self) -> Rect<f64> { + Rect::new(self.position.x, self.position.y, 0., 0.) + } +} |
