overview wiki api reference download
 All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Protected Member Functions
gameplay::TileSet Class Reference

#include <TileSet.h>

Inheritance diagram for gameplay::TileSet:
gameplay::Ref gameplay::Drawable

List of all members.

Public Member Functions

void setTileSource (unsigned int column, unsigned int row, const Vector2 &source)
void getTileSource (unsigned int column, unsigned int row, Vector2 *source)
float getTileWidth () const
float getTileHeight () const
unsigned int getRowCount () const
unsigned int getColumnCount () const
float getWidth () const
float getHeight () const
void setOpacity (float opacity)
float getOpacity () const
void setColor (const Vector4 &color)
const Vector4getColor () const
unsigned int draw (bool wireframe=false)

Static Public Member Functions

static TileSetcreate (const char *imagePath, float tileWidth, float tileHeight, unsigned int rowCount, unsigned int columnCount)
static TileSetcreate (Properties *properties)

Protected Member Functions

 TileSet ()
 ~TileSet ()
TileSetoperator= (const TileSet &set)
Drawableclone (NodeCloneContext &context)

Detailed Description

Defines a grid of tiles for rendering a 2D planer region.

The UVs are sourced from the texture atlas image. The columns(x) and rows(y) are set individually for each in the tile set. Specifying a source (x,y) of -1, -1 will allow for tiles in the set to be empty. The size of all the tiles must be equal to the tileWidth/tileHeight provided.

To avoid seams in the tiles the tile should be padded with a gutter of duplicate pixels on each side of the region.

The tile set does not support rotation or scaling.


Constructor & Destructor Documentation

gameplay::TileSet::TileSet ( ) [protected]

Constructor

gameplay::TileSet::~TileSet ( ) [protected]

Destructor


Member Function Documentation

Drawable* gameplay::TileSet::clone ( NodeCloneContext context) [protected, virtual]
See also:
Drawable::clone

Implements gameplay::Drawable.

static TileSet* gameplay::TileSet::create ( const char *  imagePath,
float  tileWidth,
float  tileHeight,
unsigned int  rowCount,
unsigned int  columnCount 
) [static]

Creates a tile set.

Parameters:
imagePathThe path to the image to create the sprite from.
tileWidthThe width of each tile in the tile set.
tileHeightThe height of each tile in the tile set.
rowCountThe number of tile rows.
columnCountThe number of tile columns.
Returns:
The tile set created.
static TileSet* gameplay::TileSet::create ( Properties properties) [static]

Creates a tile set from a properties object.

Parameters:
propertiesThe properties object to load from.
Returns:
The tile set created.
unsigned int gameplay::TileSet::draw ( bool  wireframe = false) [virtual]
See also:
Drawable::draw

Implements gameplay::Drawable.

Gets the color (RGBA) for the sprite.

Returns:
The color(RGBA) for the sprite.
unsigned int gameplay::TileSet::getColumnCount ( ) const

Gets the number of tile columns.

Returns:
The number of tile columns.

Gets the overall width of the tileset.

Returns:
The overall width of the tileset.

Gets the opacity for the sprite.

The range is from full transparent to opaque [0.0,1.0].

Returns:
The opacity for the sprite.
unsigned int gameplay::TileSet::getRowCount ( ) const

Gets the number of tile rows.

Returns:
The number of tile rows.

Gets the height of each tile in the tile set.

Returns:
The height of each tile in the tile set.
void gameplay::TileSet::getTileSource ( unsigned int  column,
unsigned int  row,
Vector2 source 
)

Gets the source clip region and flip flags for the specified column and row.

Parameters:
columnThe column to get the source clip region and flip flags for.
rowThe row to specify the source clip region and flip flags for.
sourceThe source region to be returned back.
See also:
Sprite::FlipFlags

Gets the width of each tile in the tile set.

Returns:
The width of each tile in the tile set.
float gameplay::TileSet::getWidth ( ) const

Gets the overall width of the tileset.

Returns:
The overall width of the tileset.
TileSet& gameplay::TileSet::operator= ( const TileSet set) [protected]

operator=

void gameplay::TileSet::setColor ( const Vector4 color)

Sets the color (RGBA) for the sprite.

Parameters:
colorThe color(RGBA) for the sprite.
void gameplay::TileSet::setOpacity ( float  opacity)

Sets the opacity for the sprite.

The range is from full transparent to opaque [0.0,1.0].

Parameters:
opacityThe opacity for the sprite.
void gameplay::TileSet::setTileSource ( unsigned int  column,
unsigned int  row,
const Vector2 source 
)

Sets the tile source location for the specified column and row.

Parameters:
columnThe column to set the source for.
rowThe row to set the source for.
sourceThe source top-left corner where the tile is positioned.
 All Classes Functions Variables Typedefs Enumerations Enumerator