sprite.rs 518 Bytes
Newer Older
Simon Goller's avatar
Simon Goller committed
1
2
3
4
use crate::resources;

pub struct Sprite {
    pub image_handle: resources::ImageHandle,
5
    pub offset: nalgebra::Vector2<f32>,
Simon Goller's avatar
Simon Goller committed
6
7
8
}

impl Sprite {
9
    pub fn new<S: Into<resources::ImageHandle>>(handle: S) -> Self {
10
11
12
13
14
15
16
        Self::with_offset(handle, nalgebra::Vector2::new(0.0, 0.0))
    }

    pub fn with_offset<S: Into<resources::ImageHandle>>(
        handle: S,
        offset: nalgebra::Vector2<f32>,
    ) -> Self {
17
18
        Sprite {
            image_handle: handle.into(),
19
            offset,
20
        }
Simon Goller's avatar
Simon Goller committed
21
22
    }
}