Gamedev Framework (gf)  0.17.0
A C++14 framework for 2D games
Public Member Functions | Public Attributes | List of all members
gf::TmxTileset Struct Reference

A set of tiles in a single file (image or TSX file) More...

#include <gf/Tmx.h>

Public Member Functions

const TmxTilegetTile (int id) const noexcept
 Get the tile corresponding to an id. More...
 
RectI getSubTexture (int id, Vector2i size) const noexcept
 Get the rectangle of a tile corresponding to an id. More...
 

Public Attributes

TmxProperties properties
 The properties of the tileset. More...
 
int firstGid
 The first global id of the tileset. More...
 
std::string name
 The name of the tileset. More...
 
Vector2i tileSize
 The size of a tile in the tileset. More...
 
int spacing
 The spacing between tiles (in pixels) More...
 
int margin
 The margin around tiles (in pixels) More...
 
int tileCount
 The number of tiles. More...
 
int columnCount
 The number of columns. More...
 
Vector2i offset
 The offset of the tileset. More...
 
std::unique_ptr< TmxImageimage
 The image of the tileset. More...
 
std::vector< TmxTerrainterrains
 The terrains of the tileset. More...
 
std::vector< TmxTiletiles
 The tiles of the tileset. More...
 

Detailed Description

A set of tiles in a single file (image or TSX file)

Member Function Documentation

◆ getSubTexture()

RectI gf::TmxTileset::getSubTexture ( int  id,
Vector2i  size 
) const
noexcept

Get the rectangle of a tile corresponding to an id.

Parameters
idThe id of the tile
sizeThe size of the image corresponding to the tile
Returns
The rectangle of the tile

◆ getTile()

const TmxTile* gf::TmxTileset::getTile ( int  id) const
noexcept

Get the tile corresponding to an id.

Parameters
idThe id of the tile
Returns
The tile

Member Data Documentation

◆ columnCount

int gf::TmxTileset::columnCount

The number of columns.

◆ firstGid

int gf::TmxTileset::firstGid

The first global id of the tileset.

◆ image

std::unique_ptr<TmxImage> gf::TmxTileset::image

The image of the tileset.

◆ margin

int gf::TmxTileset::margin

The margin around tiles (in pixels)

◆ name

std::string gf::TmxTileset::name

The name of the tileset.

◆ offset

Vector2i gf::TmxTileset::offset

The offset of the tileset.

◆ properties

TmxProperties gf::TmxTileset::properties

The properties of the tileset.

◆ spacing

int gf::TmxTileset::spacing

The spacing between tiles (in pixels)

◆ terrains

std::vector<TmxTerrain> gf::TmxTileset::terrains

The terrains of the tileset.

◆ tileCount

int gf::TmxTileset::tileCount

The number of tiles.

◆ tiles

std::vector<TmxTile> gf::TmxTileset::tiles

The tiles of the tileset.

◆ tileSize

Vector2i gf::TmxTileset::tileSize

The size of a tile in the tileset.