use super::*;
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq, PartialOrd)]
pub struct SpriteFrame {
#[get(type(copy))]
pub(crate) source: Rect,
#[get(type(copy))]
pub(crate) duration: f64,
}
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct SpriteSheet {
pub(crate) image: HtmlImageElement,
#[get(type(copy))]
pub(crate) frame_width: f64,
#[get(type(copy))]
pub(crate) frame_height: f64,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) columns: u32,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) rows: u32,
}
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct SpriteAnimation {
pub(crate) name: String,
pub(crate) frames: Vec<SpriteFrame>,
#[get(type(copy))]
pub(crate) mode: AnimationMode,
}
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct Animator {
#[get(type(clone))]
#[get_mut(pub(crate))]
#[new(skip)]
pub(crate) current_animation: Option<SpriteAnimation>,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
#[new(skip)]
pub(crate) current_frame_index: usize,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
#[new(skip)]
pub(crate) elapsed_time: f64,
#[get(type(copy))]
#[get_mut(pub(crate))]
pub(crate) state: AnimationState,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) direction: i32,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[new(skip)]
pub(crate) flip_x: bool,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[new(skip)]
pub(crate) flip_y: bool,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct NineSliceRects {
#[get(type(copy))]
pub(crate) grid: [[Rect; 3]; 3],
}
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct NineSliceInsets {
#[get(type(copy))]
pub(crate) left: f64,
#[get(type(copy))]
pub(crate) right: f64,
#[get(type(copy))]
pub(crate) top: f64,
#[get(type(copy))]
pub(crate) bottom: f64,
}
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct NineSlice {
#[get(type(clone))]
pub(crate) image: HtmlImageElement,
#[get(type(copy))]
pub(crate) insets: NineSliceInsets,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct UvRect {
#[get(type(copy))]
pub(crate) u0: f64,
#[get(type(copy))]
pub(crate) v0: f64,
#[get(type(copy))]
pub(crate) u1: f64,
#[get(type(copy))]
pub(crate) v1: f64,
}
#[derive(Clone, Data, Debug, Default, New, PartialEq)]
pub struct AtlasRegions {
#[get]
#[get_mut(pub(crate))]
pub(crate) regions: HashMap<String, Rect>,
}
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct SpriteAtlas {
#[get(type(clone))]
pub(crate) image: HtmlImageElement,
#[get(type(clone))]
pub(crate) regions: AtlasRegions,
}