Struct Level

Source
pub struct Level {
Show 18 fields pub __neighbours: Vec<NeighbourLevel>, pub uid: i32, pub __bg_pos: Option<Value>, pub bg_pivot_x: f32, pub bg_rel_path: Option<String>, pub world_x: i32, pub bg_pivot_y: f32, pub field_instances: Vec<FieldInstance>, pub px_hei: i32, pub layer_instances: Option<Vec<LayerInstance>>, pub px_wid: i32, pub identifier: String, pub use_auto_identifier: bool, pub external_rel_path: Option<String>, pub bg_pos: Option<Value>, pub bg_color: Option<String>, pub __bg_color: String, pub world_y: i32,
}
Expand description

This section contains all the level data. It can be found in 2 distinct forms, depending on Project current settings: - If “Separate level files” is disabled (default): full level data is embedded inside the main Project JSON file, - If “Separate level files” is enabled: level data is stored in separate standalone .ldtkl files (one per level). In this case, the main Project JSON file will still contain most level data, except heavy sections, like the layerInstances array (which will be null). The externalRelPath string points to the ldtkl file. A ldtkl file is just a JSON file containing exactly what is described below.

Fields§

§__neighbours: Vec<NeighbourLevel>

An array listing all other levels touching this one on the world map. In “linear” world layouts, this array is populated with previous/next levels in array, and dir depends on the linear horizontal/vertical layout.

§uid: i32

Unique Int identifier

§__bg_pos: Option<Value>

Position informations of the background image, if there is one.

§bg_pivot_x: f32

Background image X pivot (0-1)

§bg_rel_path: Option<String>

The optional relative path to the level background image.

§world_x: i32

World X coordinate in pixels

§bg_pivot_y: f32

Background image Y pivot (0-1)

§field_instances: Vec<FieldInstance>

An array containing this level custom field values.

§px_hei: i32

Height of the level in pixels

§layer_instances: Option<Vec<LayerInstance>>

An array containing all Layer instances. IMPORTANT: if the project option “Save levels separately” is enabled, this field will be null.
This array is sorted in display order: the 1st layer is the top-most and the last is behind.

§px_wid: i32

Width of the level in pixels

§identifier: String

Unique String identifier

§use_auto_identifier: bool

If TRUE, the level identifier will always automatically use the naming pattern as defined in Project.levelNamePattern. Becomes FALSE if the identifier is manually modified by user.

§external_rel_path: Option<String>

This value is not null if the project option “Save levels separately” is enabled. In this case, this relative path points to the level Json file.

§bg_pos: Option<Value>

An enum defining the way the background image (if any) is positioned on the level. See __bgPos for resulting position info. Possible values: <null>, Unscaled, Contain, Cover, CoverDirty

§bg_color: Option<String>

Background color of the level. If null, the project defaultLevelBgColor should be used.

§__bg_color: String

Background color of the level (same as bgColor, except the default value is automatically used here if its value is null)

§world_y: i32

World Y coordinate in pixels

Trait Implementations§

Source§

impl Clone for Level

Source§

fn clone(&self) -> Level

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Level

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Level

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Level

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Level

§

impl RefUnwindSafe for Level

§

impl Send for Level

§

impl Sync for Level

§

impl Unpin for Level

§

impl UnwindSafe for Level

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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