mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
types required for aseprite import
This commit is contained in:
parent
8792146ddb
commit
9714b8a3ca
|
@ -15,4 +15,5 @@ toml = "0.5.8"
|
|||
serde = { version = "1.0", features = ["derive"] }
|
||||
syn = "1.0.86"
|
||||
proc-macro2 = "1.0.36"
|
||||
quote = "1.0.15"
|
||||
quote = "1.0.15"
|
||||
serde_json = "1.0"
|
56
agb-image-converter/src/aseprite.rs
Normal file
56
agb-image-converter/src/aseprite.rs
Normal 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,
|
||||
}
|
|
@ -5,6 +5,7 @@ use std::path::Path;
|
|||
|
||||
use quote::{format_ident, quote};
|
||||
|
||||
mod aseprite;
|
||||
mod colour;
|
||||
mod config;
|
||||
mod image_loader;
|
||||
|
|
Loading…
Reference in a new issue