1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use rask_engine::math;

pub type AnimationId = u32;
pub type FrameId = u32;
pub type TextureId = u32;

#[derive(Clone, Copy, Debug)]
pub struct Sprite {
    pub transform: math::Mat3,
    pub tex_id: TextureId,
}

impl Default for Sprite {
    fn default() -> Self {
        Self {
            transform: math::Mat3::new(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0),
            tex_id: 0,
        }
    }
}

impl Sprite {
    pub fn new(transform: math::Mat3, tex_id: TextureId) -> Self {
        Self { transform, tex_id }
    }
}

#[derive(Debug)]
pub struct Frame {
    transformations: Vec<math::Mat3>,
}

impl Frame {
    pub fn transformations(&self) -> &[math::Mat3] {
        &self.transformations
    }
}

impl Frame {
    pub fn new(transformations: Vec<math::Mat3>) -> Self {
        Self { transformations }
    }
}