TurtleBrains  0.2.1
High quality, portable, C++ API for native application and game development.
TurtleBrains::Graphics::SpriteSheet Class Reference

#include <tb_sprite_sheet.h>

Public Member Functions

 SpriteSheet (const TextureHandle &textureHandle=kInvalidTexture)
 
void AddSpriteFrame (const tbCore::tbString &spriteName, const SpriteFrame &spriteFrame)
 
const SpriteFrameGetSpriteFrame (const tbCore::tbString &spriteName) const
 
void AddAnimationSequence (const tbCore::tbString &animationName, const AnimationSequence &animationSequence)
 
const AnimationSequenceGetAnimationSequence (const tbCore::tbString &animationName) const
 
void AddAnimationSequencesToSprite (const tbCore::tbString &spriteName, const std::vector< tbCore::tbString > &animationNames)
 
bool HasAnimationsForSprite (const tbCore::tbString &spriteName) const
 
const std::vector< tbCore::tbString > & GetAnimationsForSprite (const tbCore::tbString &spriteName) const
 
void SetTextureHandle (const TextureHandle &textureHandle)
 
const TextureHandleGetTextureHandle (void) const
 

Detailed Description

A sprite sheet is a collection of information regarding the sprites on a particular texture file. Each Sprite has a sprite frame, location and size on the texture and can optionally have animation sequences as well. It would be rare for the Spritesheet objects tb be used directly as the SpriteManager handles the loading of the sprite sheets as well as the creation of the Sprite objects and AnimatedSprite objects.

Note
This shall be considered a TurtleBrains implementation detail. Until further notice do not use the SpriteSheet directly or risk future changes/access loss.

Constructor & Destructor Documentation

TurtleBrains::Graphics::SpriteSheet::SpriteSheet ( const TextureHandle textureHandle = kInvalidTexture)
explicit

This is an implementation detail of the SpriteManager and should not be used directly.

Note
The SpriteSheet must have a valid texture before any SpriteFrame objects can be added

Member Function Documentation

void TurtleBrains::Graphics::SpriteSheet::AddAnimationSequence ( const tbCore::tbString animationName,
const AnimationSequence animationSequence 
)

This is an implementation detail of the SpriteManager and should not be used directly.

void TurtleBrains::Graphics::SpriteSheet::AddAnimationSequencesToSprite ( const tbCore::tbString spriteName,
const std::vector< tbCore::tbString > &  animationNames 
)

This is an implementation detail of the SpriteManager and should not be used directly.

void TurtleBrains::Graphics::SpriteSheet::AddSpriteFrame ( const tbCore::tbString spriteName,
const SpriteFrame spriteFrame 
)

This is an implementation detail of the SpriteManager and should not be used directly.

Note
The SpriteSheet must have a valid texture before any SpriteFrame objects can be added otherwise an error condition will be triggered. Each SpriteFrame must have the exact TextureHandle or an error condition will be triggered.
const AnimationSequence& TurtleBrains::Graphics::SpriteSheet::GetAnimationSequence ( const tbCore::tbString animationName) const

This is an implementation detail of the SpriteManager and should not be used directly.

Note
If no animation sequence exists on the for animationeName an error condition will be triggered.
const std::vector<tbCore::tbString>& TurtleBrains::Graphics::SpriteSheet::GetAnimationsForSprite ( const tbCore::tbString spriteName) const

This is an implementation detail of the SpriteManager and should not be used directly.

const SpriteFrame& TurtleBrains::Graphics::SpriteSheet::GetSpriteFrame ( const tbCore::tbString spriteName) const

This is an implementation detail of the SpriteManager and should not be used directly.

Note
If no sprite data exists on the sheet for the spriteName provided an error condition will be triggered.
const TextureHandle& TurtleBrains::Graphics::SpriteSheet::GetTextureHandle ( void  ) const

This is an implementation detail of the SpriteManager and should not be used directly.

bool TurtleBrains::Graphics::SpriteSheet::HasAnimationsForSprite ( const tbCore::tbString spriteName) const

This is an implementation detail of the SpriteManager and should not be used directly.

void TurtleBrains::Graphics::SpriteSheet::SetTextureHandle ( const TextureHandle textureHandle)

This is an implementation detail of the SpriteManager and should not be used directly.

Note
The SpriteSheet must have a valid texture before any SpriteFrame objects can be added.