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