use crate::*;
#[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(pub(crate), type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) columns: u32,
#[get(pub(crate), 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(pub(crate), type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
#[new(skip)]
pub(crate) current_frame_index: usize,
#[get(pub(crate), 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(pub(crate), 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,
}