[][src]Struct rs_tiled_json::tileset::Tile

pub struct Tile {
    pub id: u16,
    pub image: Option<String>,
    pub imageheight: u16,
    pub imagewidth: u16,
    pub ttype: Option<String>,
    pub objectgroup: Option<Layer>,
    pub animation: Vec<Frame>,
    pub properties: Vec<Property>,
}

Tile contains data relevant to overrides of the tileset. This is for containing data specific to certain tiles within the tileset, such animations, collisions, different images, and properties.

This struct implements the trait HasProperty, which enables easy access of Tiled properties for Tiles. The relevant functions are:

    tiled_json::Tile::get_property(&self, name: &str) -> Option<&tiled_json::Property>;
    tiled_json::Tile::get_property_vector(&self) -> &Vec<tiled_json::Property>;
    tiled_json::Tile::get_property_value(&self, name: &str) -> Option<&tiled_json::PropertyValue>;
    // See the tiled_json::Property struct to see functionality offered.

Fields

id: u16image: Option<String>imageheight: u16imagewidth: u16ttype: Option<String>objectgroup: Option<Layer>animation: Vec<Frame>properties: Vec<Property>

Methods

impl Tile[src]

pub fn get_anim(&self, msecs: u32) -> (bool, u16)[src]

This will get you the tileid of the animation frame at msecs (milliseconds) from creation.

The tuple is a boolean (whether we get an animation or not) and a u16, which will be the local id of the tile in the parent tileset.

pub fn id(&self) -> u16[src]

id refers to the local id of the tile in the tileset. This is dissimilar to the gid (global id) used for storing data in tile layers.

pub fn image_height(&self) -> u16[src]

Take the image height in pixels. If this was unspecified in Tiled, this data will be 0.

pub fn image_width(&self) -> u16[src]

Take the image width in pixels. If this was unspecified in Tiled, this data will be 0.

pub fn animation(&self) -> &Vec<Frame>[src]

Access the animation data. This vector can be empty.

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

Get the filename of the image this refers to.

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

User specified type of tile.

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

This will give you the objectgroup layer. This is for determining collisions as defined in the tileset.

Trait Implementations

impl Debug for Tile[src]

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

impl HasProperty for Tile[src]

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

Get access to the properties of the Tile object.

Auto Trait Implementations

impl RefUnwindSafe for Tile

impl Send for Tile

impl Sync for Tile

impl Unpin for Tile

impl UnwindSafe for Tile

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.