wsp::TiledLayer Class Reference

Capable of drawing a grid of cells with tiles from an image. More...

#include <tiledlayer.h>

Inheritance diagram for wsp::TiledLayer:

wsp::Layer

List of all members.

Public Member Functions

 TiledLayer (s32 columns, s32 rows, u32 ani)
virtual ~TiledLayer ()
 Destructor.
void SetStaticTileset (Image *image, u32 tileWidth, u32 tileHeight)
void SetCell (u32 col, u32 row, s32 tileIndex)
void FillCells (u32 col, u32 row, u32 numCols, u32 numRows, s32 tileIndex)
s32 CreateAnimatedTile ()
u32 GetAnimatedTile (s32 animatedTileIndex) const
void SetAnimatedTile (s32 animatedTileIndex, u32 staticTileIndex)
s32 GetCell (u32 col, u32 row) const
u32 GetCellWidth () const
u32 GetCellHeight () const
u32 GetColumns () const
u32 GetRows () const
const ImageGetImage () const
void SetTransparency (u8 alpha)
u8 GetTransparency () const
void Draw (f32 offsetX=0, f32 offsetY=0) const
 Draws the tiledlayer to the current viewport.


Detailed Description

Capable of drawing a grid of cells with tiles from an image.

Constructor & Destructor Documentation

wsp::TiledLayer::TiledLayer ( s32  columns,
s32  rows,
u32  ani 
)

Constructor.

Parameters:
columns The number of columns.
rows The number of rows.
ani The possible number of tiles with animations.


Member Function Documentation

void wsp::TiledLayer::SetStaticTileset ( Image image,
u32  tileWidth,
u32  tileHeight 
)

Parameters:
image The image to set as the new Tilesetlayer. If the Image has more or equal tiles, the data won't change.
tileWidth The width of each tile.
tileHeight The height of each tile.

void wsp::TiledLayer::SetCell ( u32  col,
u32  row,
s32  tileIndex 
)

Sets a cell with a specific tile.

Parameters:
col The column of the cell.
row The row of the cell.
tileIndex A static or animated tile.

void wsp::TiledLayer::FillCells ( u32  col,
u32  row,
u32  numCols,
u32  numRows,
s32  tileIndex 
)

Fills a rectangle with a specific tile.

Parameters:
col The column to start.
row The row to start.
numCols The length in columns.
numRows The length in rows.
tileIndex A static or animated tile.

s32 wsp::TiledLayer::CreateAnimatedTile (  ) 

Creates an animated tile.

Returns:
The index of the tile or 0, if there is no more space left.
See also:
TiledLayer - Animations

u32 wsp::TiledLayer::GetAnimatedTile ( s32  animatedTileIndex  )  const

Gets which tile is currently drawn on the animated tile.

Parameters:
animatedTileIndex The index of the animated tile.
Returns:
The tile currently drawn at the specified animated tile.
See also:
TiledLayer - Animations

void wsp::TiledLayer::SetAnimatedTile ( s32  animatedTileIndex,
u32  staticTileIndex 
)

Changes the tile that is drawn at the animated tile.

Parameters:
animatedTileIndex The index of the animated tile.
staticTileIndex The static tile to be drawn at the animated tile.
See also:
TiledLayer - Animations

s32 wsp::TiledLayer::GetCell ( u32  col,
u32  row 
) const

Gets the cell at a specified position.

Parameters:
col The column of the cell.
row The row of the cell.
Returns:
A static or animated tile at this position.

u32 wsp::TiledLayer::GetCellWidth (  )  const

Gets the cell width.

Returns:
The width of a single cell.

u32 wsp::TiledLayer::GetCellHeight (  )  const

Gets the cell height.

Returns:
The height of a single cell.

u32 wsp::TiledLayer::GetColumns (  )  const

Gets the size of the columns.

Returns:
The size of one column.

u32 wsp::TiledLayer::GetRows (  )  const

Gets the size of the rows.

Returns:
The size of one row.

const Image* wsp::TiledLayer::GetImage (  )  const

Gets the image of the tiledlayer.

Returns:
A pointer to the image. NULL if there is no image specified.

void wsp::TiledLayer::SetTransparency ( u8  alpha  ) 

Sets the transparency of the tiledlayer.

Parameters:
alpha Sets the transparency. Has a range from 0x00 (invisible) to 0xFF (fully visible)

u8 wsp::TiledLayer::GetTransparency (  )  const

Gets the transparency of the tiledlayer.

Returns:
The current transparency of the tiledlayer. Has a range from 0x00 (invisible) to 0xFF (fully visible)


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

Generated on Wed Jun 18 01:50:00 2008 for libwiisprite by  doxygen 1.5.5