types required for aseprite import

This commit is contained in:
Corwin 2022-02-15 21:28:21 +00:00
parent 8792146ddb
commit 9714b8a3ca
3 changed files with 59 additions and 1 deletions

View file

@ -16,3 +16,4 @@ serde = { version = "1.0", features = ["derive"] }
syn = "1.0.86" syn = "1.0.86"
proc-macro2 = "1.0.36" proc-macro2 = "1.0.36"
quote = "1.0.15" quote = "1.0.15"
serde_json = "1.0"

View file

@ -0,0 +1,56 @@
use serde::Deserialize;
#[derive(Deserialize)]
pub struct Aseprite {
pub frames: Vec<Frame>,
pub meta: Meta,
}
#[derive(Deserialize)]
pub struct Meta {
pub app: String,
pub version: String,
pub image: String,
pub format: String,
pub size: Size,
pub scale: String,
#[serde(rename = "frameTags")]
pub frame_tags: Vec<FrameTag>,
}
#[derive(Deserialize)]
pub struct Size {
pub w: u32,
pub h: u32,
}
#[derive(Deserialize, Clone, Copy)]
#[serde(rename_all = "lowercase")]
pub enum Direction {
Forward,
Backward,
Pingpong,
}
#[derive(Deserialize)]
pub struct FrameTag {
pub name: String,
pub from: u32,
pub to: u32,
pub direction: Direction,
}
#[derive(Deserialize)]
pub struct Frame {
pub frame: Frame2,
pub trimmed: bool,
}
#[derive(Deserialize)]
pub struct Frame2 {
pub x: u32,
pub y: u32,
pub w: u32,
pub h: u32,
}

View file

@ -5,6 +5,7 @@ use std::path::Path;
use quote::{format_ident, quote}; use quote::{format_ident, quote};
mod aseprite;
mod colour; mod colour;
mod config; mod config;
mod image_loader; mod image_loader;