[][src]Struct ldtk_rust::ldtk_file::LdtkFile

pub struct LdtkFile {
    pub json_version: String,
    pub default_pivot_x: f32,
    pub default_pivot_y: f32,
    pub default_grid_size: i32,
    pub bg_color: String,
    pub default_level_bg_color: String,
    pub next_uid: i32,
    pub minify_json: bool,
    pub export_tiled: bool,
    pub world_layout: String,
    pub world_grid_width: i32,
    pub world_grid_height: i32,
    pub defs: Defs,
    pub levels: Vec<Level>,
    pub redraw: bool,
}

Fields

json_version: Stringdefault_pivot_x: f32default_pivot_y: f32default_grid_size: i32bg_color: Stringdefault_level_bg_color: Stringnext_uid: i32minify_json: boolexport_tiled: boolworld_layout: Stringworld_grid_width: i32world_grid_height: i32defs: Defslevels: Vec<Level>redraw: bool

Implementations

impl LdtkFile[src]

pub fn new(f: String) -> Self[src]

Takes a path to an LDtk file and returns a rust struct of the parsed JSON. It will mirror the original JSON structure for the most part, but with CamelCase names converted to their idiomatic rust counterparts (for instance, "jsonVersion" will become "json_version").

Example

extern crate ldtk;

fn main() {
  let file_path = "assets/AutoLayers_4_Advanced.ldtk".to_string();
  let ldtk = LdtkFile::new(file_path);
  println!("First level pixel height is {}!", ldtk.levels[0].px_hei);
}

Trait Implementations

impl Debug for LdtkFile[src]

impl<'de> Deserialize<'de> for LdtkFile[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.