|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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:

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 Vector4 & | getColor () const
unsigned int | draw (bool wireframe=false)

## Static Public Member Functions

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

## Protected Member Functions

| TileSet ()
| ~TileSet ()
TileSet & | operator= (const TileSet &set)
Drawable * | clone (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:

  imagePath | The path to the image to create the sprite from.
  tileWidth | The width of each tile in the tile set.
  tileHeight | The height of each tile in the tile set.
  rowCount | The number of tile rows.
  columnCount | The 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:

  properties | The 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.

const Vector4& gameplay::TileSet::getColor | ( |  | ) | const

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.

float gameplay::TileSet::getHeight | ( |  | ) | const

Gets the overall width of the tileset.

Returns:
  The overall width of the tileset.

float gameplay::TileSet::getOpacity | ( |  | ) | const

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.

float gameplay::TileSet::getTileHeight | ( |  | ) | const

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:

  column | The column to get the source clip region and flip flags for.
  row | The row to specify the source clip region and flip flags for.
  source | The source region to be returned back.

See also:
  Sprite::FlipFlags

float gameplay::TileSet::getTileWidth | ( |  | ) | const

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:

  color | The 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:

  opacity | The 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:

  column | The column to set the source for.
  row | The row to set the source for.
  source | The source top-left corner where the tile is positioned.

All Classes Functions Variables Typedefs Enumerations Enumerator