[][src]Struct rs_tiled_json::layer::Layer

pub struct Layer {
    pub id: Option<u32>,
    pub name: String,
    pub opacity: f64,
    pub visible: bool,
    pub width: u32,
    pub height: u32,
    pub offsetx: f64,
    pub offsety: f64,
    pub ltype: LayerType,
    pub layerdata: LayerDataContainer,
    pub properties: Vec<Property>,
}

The primary method of describing nodes in maps.

Fields

id: Option<u32>name: Stringopacity: f64visible: boolwidth: u32height: u32offsetx: f64offsety: f64ltype: LayerTypelayerdata: LayerDataContainerproperties: Vec<Property>

Methods

impl Layer[src]

pub fn is_flipped_horizontally(&self, pos: usize) -> bool[src]

Determines if the item at pos is flipped along the horizontal axis.

Only appropriate for tile layers. If pos exists outside of tile layer data, false will be returned. This is used during iteration over tile layer data; to check by the gid directly, please use tiled_json::gid_flipped_horizontally(gid: u32).

pub fn is_flipped_vertically(&self, pos: usize) -> bool[src]

Determines if the item at pos is flipped along the vertical axis.

Only appropriate for tile layers. If pos exists outside of tile layer data, false will be returned. This is used during iteration over tile layer data; to check by the gid directly, please use tiled_json::gid_flipped_vertically(gid: u32).

pub fn is_flipped_diagonally(&self, pos: usize) -> bool[src]

Determines if the item at pos is flipped diagonally.

Only appropriate for tile layers. If pos exists outside of tile layer data, false will be returned. This is used during iteration over tile layer data; to check by the gid directly, please use tiled_json::gid_flipped_diagonally(gid: u32).

pub fn is_flipped_hvd(&self, pos: usize) -> (bool, bool, bool)[src]

Use this function if you need to check all axes at the same time.

  • result.0 = horizontally flipped
  • result.1 = vertically flipped
  • result.2 = diagonally flipped

Only appropriate for tile layers. If pos exists outside of tile layer data, false will be returned. This is used during iteration over tile layer data; to check by the gid directly, please use tiled_json::gid_flipped_hvd(gid: u32).

pub fn get_gid_without_flags(&self, pos: usize) -> u32[src]

Retrieve the gid at the pos submitted without any of the flags present.

Only appropriate for tile layers. If pos exists outside of tile layer data, false will be returned. This is used during iteration over tile layer data; to check by the gid directly, please use tiled_json::gid_without_flags(gid: u32).

pub fn is_tile_layer(&self) -> bool[src]

See if the layer is a tile layer.

pub fn is_object_group(&self) -> bool[src]

See if the layer is an object group.

pub fn is_image_layer(&self) -> bool[src]

See if the layer is an image layer.

pub fn is_group(&self) -> bool[src]

See if the layer is a group of layers.

pub fn get_data(&self) -> Option<&Vec<u32>>[src]

This is a shortcut method to get borrowed tile data of a Tile Layer. It will return None if this layer is not a TileLayer.

pub fn get_draworder(&self) -> Option<DrawOrder>[src]

A shortcut method to get the draworder of an objgroup layer. it will return None if the layer is not an ObjGroup layer.

pub fn get_objects_vector(&self) -> Option<&Vec<Object>>[src]

A shortcut method to borrow the Vector of Objects in an ObjectGroup layer. This will return None if the layer is not an ObjectGroup layer.

pub fn get_image(&self) -> Option<&String>[src]

A shortcut method to borrow the image string of an ImageLayer. You will get None back if self doesn't reference an ImageLayer.

pub fn get_transparentcolor(&self) -> Option<Color>[src]

A shortcut method to borrow the transparent color of an ImageLayer. You will get None back if self doesn't reference an ImageLayer.

pub fn get_layers(&self) -> Option<&Vec<Layer>>[src]

This is a shortcut function for GROUP layers. It will return the underlying vector of layers that are probably more relevant than the group itself. This will only return None if self is not describing a Group layer, even if the vector is empty.

pub fn x(&self) -> u32[src]

Get the x value of the layer (always 0).

pub fn y(&self) -> u32[src]

Get the y value of the layer (always 0).

pub fn id(&self) -> Option<u32>[src]

Not all layers have unique ids. The layers present as Tile::objectgroups do not have them, and there may be others without.

pub fn name(&self) -> &String[src]

Get the name of the layer. It is an empty string unless specified in Tiled editor.

pub fn opacity(&self) -> f64[src]

This will be 1.0 if no value was found.

pub fn visible(&self) -> bool[src]

Is this visible in the editor?

pub fn width(&self) -> u32[src]

get width in tiles! same as mapwidth since only fixed maps are supported.

pub fn height(&self) -> u32[src]

get height in tiles! same as mapheight since only fixed maps are supported.

pub fn offset_x(&self) -> f64[src]

horizontal layer offset in pixels (beyond my comprehension: its a float)

pub fn offset_y(&self) -> f64[src]

vertical layer offset in pixels (beyond my comprehension: its a float)

pub fn layer_type(&self) -> LayerType[src]

Get the Layer Type: one of LayerType::{Tile Layer, ObjectGroup, ImageLayer, Group}

Trait Implementations

impl Debug for Layer[src]

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

impl HasProperty for Layer[src]

fn get_property_vector(&self) -> &Vec<Property>[src]

Enable property access for layers.

Auto Trait Implementations

impl RefUnwindSafe for Layer

impl Send for Layer

impl Sync for Layer

impl Unpin for Layer

impl UnwindSafe for Layer

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.