LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
TileSet Class Reference

Public Member Functions

 TileSet (const std::string &file)
 
 ~TileSet ()
 
virtual void Add (const std::string &file)
 
virtual SDL_Texture * Texture (const std::string &tile)
 
virtual Recti Clip (const std::string &tile)
 
virtual std::string File (const std::string &tile)
 
virtual bool Solid (const std::string &tile)
 
int Size ()
 
mTileSetMap::iterator Begin ()
 
mTileSetMap::iterator End ()
 
virtual void Load (Json::Value val)
 
Json::Value Save ()
 

Protected Attributes

mTileSetMap mTileSet
 
mImageSetMap mImageSet
 
mTileSetMap::iterator mTileSetBegin
 
mTileSetMap::iterator mTileSetEnd
 
mImageSetMap::iterator mImageSetBegin
 
mImageSetMap::iterator mImageSetEnd
 
SDL_Texture * lastTexture
 
std::string lastTextureName
 
Tile lastTile
 
std::string lastTileName
 

Constructor & Destructor Documentation

TileSet::TileSet ( const std::string &  file)

Setup the TileSet class, if a filename is passed load the image

Parameters
fileThe filename
See Also
Window::LoadTileSet for the loading function
TileSet::~TileSet ( )

Empty

Member Function Documentation

void TileSet::Add ( const std::string &  file)
virtual

Adds an image to the tileset, and parses it's .json file into the tileset

Parameters
fileThe filename for the image
mTileSetMap::iterator TileSet::Begin ( )
inline

Returns the begining iterator of the tileset

Returns
iterator The beinging of the tileset.
Recti TileSet::Clip ( const std::string &  tile)
virtual

Gets the Recti (Box) that is associated with the passed tile name.

Parameters
tileThe name of the tile in the tileset
Returns
Recti A box for the associated iamge
mTileSetMap::iterator TileSet::End ( )
inline

Returns the end iterator of the tileset

Returns
iterator The beinging of the tileset.
std::string TileSet::File ( const std::string &  tile)
virtual

Gets the filename of the image that is associated with the passed tile name.

Parameters
tileThe name of the tile in the tileset
Returns
Recti A box for the associated iamge
void TileSet::Load ( Json::Value  val)
virtual

Load an image and its properties from a Json::Value into the tileset

Parameters
valThe Json::Value to load from
Json::Value TileSet::Save ( )

Save the tileset data to a json value and return it

Returns
Json::Value containing the tilebar data
int TileSet::Size ( )
inline

Returns the size of the tileset

Returns
int The size of the tileset
bool TileSet::Solid ( const std::string &  tile)
virtual

Gets the bool Solid property of the tile.

Parameters
tileThe name of the tile in the tileset
Returns
bool true/false for the solid state of a tile
SDL_Texture * TileSet::Texture ( const std::string &  tile)
virtual

Gets pointer to the SDL_Texture that is associated with the passed tile name.

Parameters
tileThe name of the tile in the tileset
Returns
SDL_Texture* A pointer to the associated iamge

The documentation for this class was generated from the following files: