Skip to main content

maple_render_core/
template.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct Template {
5    pub width: u32,
6    pub height: u32,
7    pub frames: u32,
8    pub delay: f64,
9    pub hold: f64,
10    pub palette: Vec<i32>,
11}
12
13impl Default for Template {
14    fn default() -> Self {
15        Template { width: 400, height: 300, frames: 1, delay: 0.1, hold: 1.0, palette: vec![0] }
16    }
17}
18
19impl Template {
20    pub fn period(&self) -> f64 {
21        self.delay
22    }
23
24    pub fn is_animation(&self) -> bool {
25        self.frames > 1
26    }
27}