Gamedev Framework (gf)  0.12.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 (unsigned id) const noexcept
 Get the tile corresponding to an id. More...
 
RectU getSubTexture (unsigned id, Vector2u size) const noexcept
 Get the rectangle of a tile corresponding to an id. More...
 

Public Attributes

TmxProperties properties
 The properties of the tileset. More...
 
unsigned firstGid
 The first global id of the tileset. More...
 
std::string name
 The name of the tileset. More...
 
Vector2u tileSize
 The size of the tileset. More...
 
unsigned spacing
 The spacing between tiles (in pixels) More...
 
unsigned margin
 The margin around tiles (in pixels) More...
 
unsigned tileCount
 The number of tiles. More...
 
unsigned 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()

RectU gf::TmxTileset::getSubTexture ( unsigned  id,
Vector2u  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 ( unsigned  id) const
noexcept

Get the tile corresponding to an id.

Parameters
idThe id of the tile
Returns
The tile

Member Data Documentation

◆ columnCount

unsigned gf::TmxTileset::columnCount

The number of columns.

◆ firstGid

unsigned gf::TmxTileset::firstGid

The first global id of the tileset.

◆ image

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

The image of the tileset.

◆ margin

unsigned 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

unsigned gf::TmxTileset::spacing

The spacing between tiles (in pixels)

◆ terrains

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

The terrains of the tileset.

◆ tileCount

unsigned gf::TmxTileset::tileCount

The number of tiles.

◆ tiles

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

The tiles of the tileset.

◆ tileSize

Vector2u gf::TmxTileset::tileSize

The size of the tileset.