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

#include <tb_sprite_sheet.h>

Public Types

typedef std::map< tbCore::tbString, AnimationSequenceAnimationSequenceContainer
 

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)
 
void AddAnimationSequence (const tbCore::tbString &spriteName, const tbCore::tbString &animationName, const AnimationSequence &animationSequence)
 
const AnimationSequenceGetAnimationSequence (const tbCore::tbString &animationName) const
 
const AnimationSequenceGetAnimationSequence (const tbCore::tbString &spriteName, const tbCore::tbString &animationName) const
 
bool AddGlobalAnimationSequencesToSprite (const tbCore::tbString &spriteName, const std::vector< tbCore::tbString > &animationNames)
 
const AnimationSequenceContainer & GetAnimationSequencesForSprite (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 to 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::AddAnimationSequence ( const tbCore::tbString spriteName,
const tbCore::tbString animationName,
const AnimationSequence animationSequence 
)

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

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

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

Returns
True if all animations were added to the sprite, or triggers an error condition.
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 AnimationSequence& TurtleBrains::Graphics::SpriteSheet::GetAnimationSequence ( const tbCore::tbString spriteName,
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 AnimationSequenceContainer& TurtleBrains::Graphics::SpriteSheet::GetAnimationSequencesForSprite ( const tbCore::tbString spriteName) const

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

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

Note
this will NOT trigger an error condition if sprite doesn't exist it will return empty container.
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.

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.