From f92e9f6f07b1e3834c2ca58ce3510734819d08e4 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Wed, 27 Jan 2021 14:01:50 +0100 Subject: Rework graf karto to fit the client/server structure --- src/world/icon.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/world/icon.rs (limited to 'src/world/icon.rs') 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, + /// Rotation of the icon texture in degrees. + pub rotation: f64, +} + +impl Component for Icon { + fn bounding_rect(&self) -> Rect { + Rect::new(self.position.x, self.position.y, 0., 0.) + } +} -- cgit v1.2.3-70-g09d2