aboutsummaryrefslogtreecommitdiff
path: root/src/world/icon.rs
blob: c8945fb37f959e13dede91e2dd52ad8c8d8b7abd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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.)
    }
}