[][src]Struct ogmo3::level::Level

pub struct Level {
    pub ogmo_version: String,
    pub width: f32,
    pub height: f32,
    pub offset_x: f32,
    pub offset_y: f32,
    pub values: HashMap<String, Value>,
    pub layers: Vec<Layer>,
}

An Ogmo level.

Fields

ogmo_version: String

The version of Ogmo used to export this level.

width: f32

The width of the level.

height: f32

The height of the level.

offset_x: f32

The offset of the level on the X axis. Useful for loading multiple chunked levels.

offset_y: f32

The offset of the level on the Y axis. Useful for loading multiple chunked levels.

values: HashMap<String, Value>

The level's custom values.

layers: Vec<Layer>

The layers that make up the level.

Implementations

impl Level[src]

pub fn from_json(s: &str) -> Result<Level, Error>[src]

Parses an Ogmo level from a JSON string.

Errors

  • Error::Json will be returned if deserialization fails.

pub fn from_file(path: impl AsRef<Path>) -> Result<Level, Error>[src]

Parses an Ogmo level from a file.

Errors

  • Error::Io will be returned if the file cannot be read.
  • Error::Json will be returned if deserialization fails.

pub fn to_json(&self) -> Result<String, Error>[src]

Writes the Ogmo level to a JSON string.

Errors

  • Error::Json will be returned if serialization fails.

pub fn to_json_pretty(&self) -> Result<String, Error>[src]

Writes the Ogmo level to a pretty-printed JSON string.

Errors

  • Error::Json will be returned if serialization fails.

Trait Implementations

impl Clone for Level[src]

impl Debug for Level[src]

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

impl Serialize for Level[src]

Auto Trait Implementations

impl RefUnwindSafe for Level

impl Send for Level

impl Sync for Level

impl Unpin for Level

impl UnwindSafe for Level

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.