Skip to content

Tileset

Modar Nasser edited this page Dec 14, 2024 · 17 revisions

In file LDtkLoader/Tileset.hpp

Class : ldtk::Tileset

A Tileset contains information about a texture used to draw tiles.

Fields

name

const std::string ldtk::Tileset::name

Name of the Tileset.

🔝

uid

const int ldtk::Tileset::uid

Unique identifier of the Tileset.

🔝

path

const std::string ldtk::Tileset::path

Relative path to the Tileset's texture image file.

🔝

texture_size

const ldtk::IntPoint ldtk::Tileset::texture_size

Size in pixels of the Tileset's texture.

🔝

tile_size

const int ldtk::Tileset::tile_size

Size in pixels of a tile in the Tileset. Tiles are always square shaped.

🔝

spacing

const int ldtk::Tileset::spacing

Spacing in pixels between tiles in the Tileset.

🔝

padding

const int ldtk::Tileset::padding

Padding in pixels to the first row and column of tiles in the Tileset.

🔝

Methods

getTileIdAt

ldtk::Tileset::getTileIdAt(int pos_x, int pos_y) const -> int

Returns the tile id at the given position in pixels.

🔝

getTileTexturePos

ldtk::Tileset::getTileTexturePos(int tile_id) const -> ldtk::IntPoint

Returns the texture coordinates of the Tile ID.

🔝

getTileCustomData

ldtk::Tileset::getTileCustomData(int tile_id) const -> const std::string&

Returns the custom data associated with the Tile ID.

🔝

getTileEnumTags

ldtk::Tileset::getTileEnumTags(int tile_id) const -> const std::vector<std::reference_wrapper<const EnumValue>>&

Returns a vector containing the EnumTags associated with the Tile ID.

🔝

hasEnumTags

ldtk::Tileset::hasEnumTags() const -> bool

Returns true if the Tileset has enum tags associated to tiles, false otherwise.

🔝

getEnumTagsEnum

ldtk::Tileset::getEnumTagsEnum() const -> const Enum&

Returns the Enum type used by this Tileset's EnumTags.

🔝

getTilesByEnumTag

ldtk::Tileset::getTilesByEnumTag(const ldtk::EnumValue& enumvalue) const -> const std::vector<int>&

Get a vector of all tiles ID tagged with a given EnumValue.

Throws an invalid_argument exception if the EnumValue argument does not have the right Enum type.

🔝

hasTag

Inherited from TagsContainer

ldtk::Tileset::hasTag(const std::string&) const -> bool

Returns true if the Tileset contains the given tag, returns false otherwise.

🔝

allTags

Inherited from TagsContainer

ldtk::Tileset::allTags() const -> const std::vector<std::string>&

Returns a vector containing all the tags in the Tileset.

🔝

Clone this wiki locally