TurtleBrains  0.3.1
High quality, portable, C++ framework for rapid 2D game development.
TurtleBrains::Graphics::SpriteMap Class Reference

#include <tb_sprite_map.h>

Public Member Functions

 SpriteMap (const TextureHandle &textureHandle, const PixelSpace &frameWidth, const PixelSpace &frameHeight, const PixelSpace &spacingX=0, const PixelSpace &spacingY=0, const PixelSpace &offsetX=0, const PixelSpace &offsetY=0)
 
virtual ~SpriteMap (void)
 
SpriteFrame GetSpriteFrameAtIndex (const size_t &frameIndex) const
 
SpriteFrame GetSpriteFrameAtLocation (const size_t &frameColumn, const size_t &frameRow) const
 
size_t GetIndexCount (void) const
 
size_t GetColumnCount (void) const
 
size_t GetRowCount (void) const
 
PixelSpace GetFrameWidth (void) const
 
PixelSpace GetFrameHeight (void) const
 
TextureHandle GetTextureHandle (void) const
 
void RenderSpritesByIndex (const tbCore::uint16 *const spriteArray, const size_t &columnCount, const size_t &rowCount, const tbMath::Vector2 &position=tbMath::Vector2::Zero()) const
 

Detailed Description

Provides an interface to create sprite frames by index or location for the AnimationSequences or the TileSystem and will contain a way to efficiently render an array of these sprite frames for the TileSystem.

Constructor & Destructor Documentation

TurtleBrains::Graphics::SpriteMap::SpriteMap ( const TextureHandle textureHandle,
const PixelSpace frameWidth,
const PixelSpace frameHeight,
const PixelSpace spacingX = 0,
const PixelSpace spacingY = 0,
const PixelSpace offsetX = 0,
const PixelSpace offsetY = 0 
)

Creates a SpriteMap of the given texture which will describe where each SpriteFrame is located when given a location (column, row) or index.

Parameters
textureHandleThe texture that the SpriteMap is referring to, MUST be a valid TextureHandle or an errro condition will be triggered.
frameWidthThe width of each sprite frame in the map, in pixels, on the texture.
frameHeightThe height of each sprite frame in the map, in pixels, on the texture.
spacingXAn optional value for horizontal spacing between each sprite frame in pixels.
spacingYAn optional value for vertical spacing between each sprite frame in pixels.
offsetXAn optional horizontal offset to the left edge of the first mapped frame, if used the first row is shifted right horizontally by this amount in pixels.
offsetYAn optional vertical offset to the top efge of the first mapped frame, if used the first column is shifted down vertically by this amount in pixels.
Note
textureHandle MUST be valid or an error condition will be triggered.
virtual TurtleBrains::Graphics::SpriteMap::~SpriteMap ( void  )
virtual

Destroys and cleans up after the SpriteMap, ?which may include deleting an array of indices? TODO: TurtleBrains: Documentation: Teach the user how to use this.

Member Function Documentation

size_t TurtleBrains::Graphics::SpriteMap::GetColumnCount ( void  ) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

PixelSpace TurtleBrains::Graphics::SpriteMap::GetFrameHeight ( void  ) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

PixelSpace TurtleBrains::Graphics::SpriteMap::GetFrameWidth ( void  ) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

size_t TurtleBrains::Graphics::SpriteMap::GetIndexCount ( void  ) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

size_t TurtleBrains::Graphics::SpriteMap::GetRowCount ( void  ) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

SpriteFrame TurtleBrains::Graphics::SpriteMap::GetSpriteFrameAtIndex ( const size_t &  frameIndex) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

SpriteFrame TurtleBrains::Graphics::SpriteMap::GetSpriteFrameAtLocation ( const size_t &  frameColumn,
const size_t &  frameRow 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

TextureHandle TurtleBrains::Graphics::SpriteMap::GetTextureHandle ( void  ) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

void TurtleBrains::Graphics::SpriteMap::RenderSpritesByIndex ( const tbCore::uint16 *const  spriteArray,
const size_t &  columnCount,
const size_t &  rowCount,
const tbMath::Vector2 position = tbMath::Vector2::Zero() 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.