Struct tiled::Tileset

source ·
pub struct Tileset {
Show 13 fields pub name: String, pub tile_width: u32, pub tile_height: u32, pub spacing: u32, pub margin: u32, pub tilecount: u32, pub columns: u32, pub offset_x: i32, pub offset_y: i32, pub image: Option<Image>, pub wang_sets: Vec<WangSet>, pub properties: Properties, pub user_type: Option<String>, /* private fields */
}
Expand description

A collection of tiles for usage in maps and template objects.

Also see the TMX docs.

Fields§

§name: String

The name of the tileset, set by the user.

§tile_width: u32

The (maximum) width in pixels of the tiles in this tileset. Irrelevant for image collection tilesets.

§tile_height: u32

The (maximum) height in pixels of the tiles in this tileset. Irrelevant for image collection tilesets.

§spacing: u32

The spacing in pixels between the tiles in this tileset (applies to the tileset image). Irrelevant for image collection tilesets.

§margin: u32

The margin around the tiles in this tileset (applies to the tileset image). Irrelevant for image collection tilesets.

§tilecount: u32

The number of tiles in this tileset. Note that tile IDs don’t always have a connection with the tile count, and as such there may be tiles with an ID bigger than the tile count.

§columns: u32

The number of tile columns in the tileset. Editable for image collection tilesets, otherwise calculated using image width, tile width, spacing and margin.

§offset_x: i32

The x-offset to be used when drawing tiles of this tileset.

§offset_y: i32

The y-offset to be used when drawing tiles of this tileset.

§image: Option<Image>

A tileset can either:

  • have a single spritesheet image in tileset (“regular” tileset);
  • have zero images in tileset and one image per tile (“image collection” tileset).

§wang_sets: Vec<WangSet>

All the wangsets present in this tileset.

§properties: Properties

The custom properties of the tileset.

§user_type: Option<String>

The custom tileset type, arbitrarily set by the user.

Implementations§

source§

impl Tileset

source

pub fn get_tile(&self, id: TileId) -> Option<Tile<'_>>

Gets the tile with the specified ID from the tileset.

source

pub fn tiles(&self) -> impl ExactSizeIterator<Item = (TileId, Tile<'_>)>

Iterates through the tiles from this tileset.

Trait Implementations§

source§

impl Clone for Tileset

source§

fn clone(&self) -> Tileset

Returns a copy 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 Tileset

source§

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

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

impl PartialEq for Tileset

source§

fn eq(&self, other: &Tileset) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Tileset

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.