libtmx  0.4.0
an C++11 library for reading TMX files
Public Member Functions | List of all members
tmx::Tile Class Reference

A tile is a rectangular part of a tileset. More...

#include <tmx/Tile.h>

Inheritance diagram for tmx::Tile:
Inheritance graph
[legend]

Public Member Functions

 Tile (unsigned id, const std::array< unsigned, 4 > &terrain, unsigned probability)
 Tile constructor. More...
 
unsigned getId () const noexcept
 Get the local id of the tile. More...
 
const std::array< unsigned, 4 > & getTerrain () const noexcept
 Get the terrains on the four corners. More...
 
unsigned getTopLeftTerrain () const noexcept
 Get the terrain in the top left corner. More...
 
unsigned getTopRightTerrain () const noexcept
 Get the terrain in the top right corner. More...
 
unsigned getBottomLeftTerrain () const noexcept
 Get the terrain in the bottom left corner. More...
 
unsigned getBottomRightTerrain () const noexcept
 Get the terrain in the bottom right corner. More...
 
unsigned getProbability () const noexcept
 Get the probability of this tile. More...
 
void setImage (std::unique_ptr< Image > image)
 Get the image of this tile. More...
 
bool hasImage () const noexcept
 Tell whether the tile has an image. More...
 
const ImagegetImage () const noexcept
 Get the image of this tile. 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...
 

Detailed Description

A tile is a rectangular part of a tileset.

Constructor & Destructor Documentation

tmx::Tile::Tile ( unsigned  id,
const std::array< unsigned, 4 > &  terrain,
unsigned  probability 
)
inline

Tile constructor.

Member Function Documentation

unsigned tmx::Tile::getBottomLeftTerrain ( ) const
inlinenoexcept

Get the terrain in the bottom left corner.

Returns
the terrain in the bottom left corner
unsigned tmx::Tile::getBottomRightTerrain ( ) const
inlinenoexcept

Get the terrain in the bottom right corner.

Returns
the terrain in the bottom right corner
unsigned tmx::Tile::getId ( ) const
inlinenoexcept

Get the local id of the tile.

Returns
the local id of the tile
const Image* tmx::Tile::getImage ( ) const
inlinenoexcept

Get the image of this tile.

Returns
the image of this tile
unsigned tmx::Tile::getProbability ( ) const
inlinenoexcept

Get the probability of this tile.

Returns
the probability of this tile
const std::array<unsigned, 4>& tmx::Tile::getTerrain ( ) const
inlinenoexcept

Get the terrains on the four corners.

Returns
the terrains
unsigned tmx::Tile::getTopLeftTerrain ( ) const
inlinenoexcept

Get the terrain in the top left corner.

Returns
the terrain in the top left corner
unsigned tmx::Tile::getTopRightTerrain ( ) const
inlinenoexcept

Get the terrain in the top right corner.

Returns
the terrain in the top right corner
bool tmx::Tile::hasImage ( ) const
inlinenoexcept

Tell whether the tile has an image.

Returns
true if the tile has an image (generally false)
void tmx::Tile::setImage ( std::unique_ptr< Image image)
inline

Get the image of this tile.

Parameters
imagethe image of this tile