[][src]Struct rs_tiled_json::tileset::Tileset

pub struct Tileset {
    pub tiledversion: String,
    pub image: String,
    pub firstgid: u32,
    pub imageheight: u16,
    pub imagewidth: u16,
    pub tileheight: u16,
    pub tilewidth: u16,
    pub tilecount: u32,
    pub columns: u16,
    pub margin: u16,
    pub spacing: u16,
    pub name: String,
    pub backgroundcolor: Option<Color>,
    pub transparentcolor: Option<Color>,
    pub grid: Option<Grid>,
    pub tiles: Vec<Tile>,
    pub tileoffset: Option<TileOffset>,
    pub properties: Vec<Property>,
}

The primary means of capturing image data.

Fields

tiledversion: Stringimage: Stringfirstgid: u32imageheight: u16imagewidth: u16tileheight: u16tilewidth: u16tilecount: u32columns: u16margin: u16spacing: u16name: Stringbackgroundcolor: Option<Color>transparentcolor: Option<Color>grid: Option<Grid>tiles: Vec<Tile>tileoffset: Option<TileOffset>properties: Vec<Property>

Methods

impl Tileset[src]

pub fn coord_by_gid(&self, gid: u32) -> (u16, u16)[src]

This will give you the coordinates in the image of the tile referenced by the gid provided. You should be sure gid belongs to this tileset.

This does not take into account any possible animations that may be on the map. If you need animation data, then use anim_by_gid().

pub fn anim_by_gid(&self, gid: u32, milliseconds: u32) -> (u16, u16)[src]

This will give you the coordinates of the tile referenced by the gid provided.
You should be sure gid belongs to this tileset.

You must provided the amount of milliseconds that have passed since creation in order to get the correct animation frame.

pub fn collision_by_gid(&self, gid: u32) -> Option<&Layer>[src]

Tiles may have collision data. It is named objectgroup in Tiled; an objectgroup layer defining a collection of objects.

pub fn type_by_gid(&self, gid: u32) -> Option<&String>[src]

Tiles may have user-defined 'types' in Tiled. Retreive one if it exists for this gid.

pub fn tile_by_gid(&self, gid: u32) -> Option<&Tile>[src]

Get a reference to a Tile object if one exists in this tileset by the gid of one specified.

pub fn properties_by_gid(&self, gid: u32) -> Option<&Vec<Property>>[src]

Tiles will have their own property lists if defined so in Tiled.
This function will provide a reference to the property vector if it exists. If it does not, you may want to refer to the properties of the entire tileset.

It may be more convenient to access the property of the tile through the tile property access methods. Use them in combination with Tileset::tile_by_gid(&self, gid: u32)

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

Get the firstgid of the tileset.

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

Get the image of the tileset as a string.

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

Image height of the tileset in pixels.

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

Image width of the tileset is in pixels.

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

Get the height of each tile in pixels.

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

Get the width of each tile in pixels.

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

Give you the number of tiles in this tileset. This will include any blank spots in the image.

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

Columns refers to the width of the tileset in tile units.

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

Rows is the height of the tileset in tile units.

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

The distance in pixels from the edge of the image to the start of the tiles. This border remains constant over all 4 edges of the image.

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

The distance in pixels from one tile to the next in both axes in the tileset image.

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

The user-defined name of the tileset in Tiled.

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

The optional background color of the tileset.

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

The optional transparent color of the tileset.

pub fn grid(&self) -> Option<Grid>[src]

An optional grid, that I'm not quite sure what it does.

pub fn tiles(&self) -> &Vec<Tile>[src]

This is a vector of any special tiles you have defined in the map editor. This will include tiles with animations, special properties, objectgroups, etc...

pub fn tile_offset(&self) -> Option<TileOffset>[src]

Get the tileoffset. It is an object with an x and a y.

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

Retrieve the version of Tiled the tileset was compiled with.

Trait Implementations

impl Debug for Tileset[src]

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

impl HasProperty for Tileset[src]

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

Get access to properties of Tileset.

Auto Trait Implementations

impl RefUnwindSafe for Tileset

impl Send for Tileset

impl Sync for Tileset

impl Unpin for Tileset

impl UnwindSafe for Tileset

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.