libtmx
0.4.0
an C++11 library for reading TMX files
|
A tileset is a set of tiles in a single file (image or TSX file). More...
#include <tmx/TileSet.h>
Public Types | |
typedef boost::transformed_range< Adaptor, const boost::iterator_range< std::vector< std::unique_ptr< Terrain > >::const_iterator > > | const_terrain_range |
A terrain range. More... | |
typedef boost::transform_iterator< Adaptor, std::vector< std::unique_ptr< Tile > >::const_iterator > | const_iterator |
A tile iterator. More... | |
Public Member Functions | |
TileSet (unsigned firstgid, const std::string &name, unsigned tilewidth, unsigned tileheight, unsigned spacing, unsigned margin, unsigned tilecount) | |
TileSet constructor. More... | |
Properties | |
unsigned | getFirstGID () const noexcept |
Get the first global id of this tileset. More... | |
const std::string & | getName () const noexcept |
Get the name of the tileset. More... | |
unsigned | getTileWidth () const noexcept |
Get the width of the tiles. More... | |
unsigned | getTileHeight () const noexcept |
Get the height of the tiles. More... | |
unsigned | getSpacing () const noexcept |
Get the spacing between tiles. More... | |
unsigned | getMargin () const noexcept |
Get the margin around tiles. More... | |
unsigned | getTileCount () const noexcept |
Get the tile count. More... | |
void | setOffset (int x, int y) noexcept |
Set the offset of the tileset. More... | |
int | getOffsetX () const noexcept |
Get the x offset of the tileset. More... | |
int | getOffsetY () const noexcept |
Get the y offset of the tileset. More... | |
Image handing | |
void | setImage (std::unique_ptr< Image > image) |
Set an image associated to the tileset. More... | |
bool | hasImage () const noexcept |
Tell whether the tileset has an image. More... | |
const Image * | getImage () const noexcept |
Get the image associated to the tileset. More... | |
Terrain handling | |
void | addTerrain (std::unique_ptr< Terrain > terrain) |
Add terrain information to the tileset. More... | |
const_terrain_range | getTerrains () const noexcept |
Get the terrains. More... | |
Tile handling | |
void | addTile (std::unique_ptr< Tile > tile) |
Add a tile to the tileset. More... | |
const_iterator | begin () const noexcept |
Get the begin iterator on the tiles. More... | |
const_iterator | end () const noexcept |
Get the end iterator on the tiles. More... | |
const Tile * | getTile (unsigned id) const noexcept |
Get the tile corresponding to an id. More... | |
Rect | getCoords (unsigned id, Size size) const noexcept |
Get the coordinates of a tile corresponding to an id. More... | |
Public Member Functions inherited from tmx::Component | |
bool | hasProperty (const std::string &key) const noexcept |
Tell if the object has a given property. More... | |
const std::string & | getProperty (const std::string &key, const std::string &def) const noexcept |
Get a property value. More... | |
bool | addProperty (const std::string &key, const std::string &value) |
Add a property. More... | |
A tileset is a set of tiles in a single file (image or TSX file).
typedef boost::transform_iterator<Adaptor, std::vector<std::unique_ptr<Tile> >::const_iterator> tmx::TileSet::const_iterator |
A tile iterator.
typedef boost::transformed_range<Adaptor, const boost::iterator_range<std::vector<std::unique_ptr<Terrain> >::const_iterator> > tmx::TileSet::const_terrain_range |
A terrain range.
|
inline |
TileSet constructor.
|
inline |
Add terrain information to the tileset.
terrain | the terrain information |
|
inline |
Add a tile to the tileset.
tile | the tile |
|
inlinenoexcept |
Get the begin iterator on the tiles.
|
inlinenoexcept |
Get the end iterator on the tiles.
Get the coordinates of a tile corresponding to an id.
id | the id of the tile |
size | the size of the image corresponding to the tile |
|
inlinenoexcept |
Get the first global id of this tileset.
|
inlinenoexcept |
Get the image associated to the tileset.
|
inlinenoexcept |
Get the margin around tiles.
|
inlinenoexcept |
Get the name of the tileset.
|
inlinenoexcept |
Get the x offset of the tileset.
|
inlinenoexcept |
Get the y offset of the tileset.
|
inlinenoexcept |
Get the spacing between tiles.
|
inlinenoexcept |
Get the terrains.
|
noexcept |
Get the tile corresponding to an id.
id | the id of the tile |
|
inlinenoexcept |
Get the tile count.
|
inlinenoexcept |
Get the height of the tiles.
|
inlinenoexcept |
Get the width of the tiles.
|
inlinenoexcept |
Tell whether the tileset has an image.
|
inline |
Set an image associated to the tileset.
image | the image associated to the tileset |
|
inlinenoexcept |
Set the offset of the tileset.
x | the x coordinate of the offset |
y | the y coordinate of the offset |