diff options
| author | Arne Dußin | 2021-01-27 14:01:50 +0100 |
|---|---|---|
| committer | Arne Dußin | 2021-02-02 22:16:15 +0100 |
| commit | f92e9f6f07b1e3834c2ca58ce3510734819d08e4 (patch) | |
| tree | 20e3d3afce342a56ae98f6c20491482ccd2b5c6b /src/world/icon.rs | |
| parent | c60a6d07efb120724b308e29e8e70f27c87c952d (diff) | |
| download | graf_karto-f92e9f6f07b1e3834c2ca58ce3510734819d08e4.tar.gz graf_karto-f92e9f6f07b1e3834c2ca58ce3510734819d08e4.zip | |
Rework graf karto to fit the client/server structure
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.) + } +} |
