TurtleBrains  0.3.1
High quality, portable, C++ framework for rapid 2D game development.
tb_sprite_manager.h
1 
9 #ifndef _TurtleBrains_SpriteManager_h_
10 #define _TurtleBrains_SpriteManager_h_
11 
12 #include "tb_sprite.h"
13 #include "tb_animated_sprite.h"
14 #include "tb_sprite_sheet.h"
15 #include "../core/tb_noncopyable.h"
16 #include "../core/tb_string.h"
17 
18 #include <map>
19 
20 namespace tbImplementation { struct LoadingSheetInformation; }
21 
22 namespace TurtleBrains
23 {
24  namespace Core { class DynamicStructure; }
25 
26  namespace Graphics
27  {
28 
34  {
35  public:
40  SpriteManager(void);
41 
46  ~SpriteManager(void);
47 
76  bool LoadSpriteSheetFromFile(const tbCore::tbString& spriteSheetName, const tbCore::tbString& spriteSheetFile);
77 
85  TextureHandle GetSpriteSheetTextureHandle(const tbCore::tbString& spriteSheetName) const;
86 
97  SpriteFrame GetSpriteFrame(const tbCore::tbString& spriteSheetName, const tbCore::tbString& spriteName) const;
98 
116  Sprite GetSpriteFromFile(const tbCore::tbString& textureFile, const PixelSpace& frameX = 0, const PixelSpace& frameY = 0,
117  const PixelSpace& frameWidth = 0, const PixelSpace& frameHeight = 0) const;
118 
129  Sprite GetSprite(const tbCore::tbString& spriteSheetName, const tbCore::tbString& spriteName) const;
130 
142  AnimatedSprite GetAnimatedSprite(const tbCore::tbString& spriteSheetName, const tbCore::tbString& spriteName) const;
143 
153  void AddAnimationSequences(const tbCore::tbString& spriteSheetName, const tbCore::tbString& spriteName, AnimatedSprite& animatedSprite) const;
154 
155  private:
156  void AddAnimationSequences(const SpriteSheet& spriteSheet, const tbCore::tbString& spriteName, AnimatedSprite& animatedSprite) const;
157 
158  bool LoadAllAnimationSequences(SpriteSheet& spriteSheet, const tbCore::tbString& forSprite,
159  const tbCore::DynamicStructure& animationSequences, const tbImplementation::LoadingSheetInformation& loadingInfo);
160  bool LoadAnimationSequence(tbGraphics::AnimationSequence& animationSequence, const tbCore::DynamicStructure& animationData,
161  const tbImplementation::LoadingSheetInformation& loadingInfo);
162 
163  typedef std::map<tbCore::tbString, SpriteSheet> SpriteSheetContainer;
164  SpriteSheetContainer mSpriteSheets;
165  };
166 
172 
173  }; /* namespace Graphics */
174 }; /* namespace TurtleBrains */
175 
177 
178 #endif /* _TurtleBrains_SpriteManager_h_ */
TextureHandle GetSpriteSheetTextureHandle(const tbCore::tbString &spriteSheetName) const
Give the GameScene and Entities something to display, Text, Sprites and AnimatedSprites help bring th...
Definition: tb_sprite.h:29
Definition: tb_sprite_manager.h:33
AnimatedSprite GetAnimatedSprite(const tbCore::tbString &spriteSheetName, const tbCore::tbString &spriteName) const
Definition: tb_noncopyable.h:22
Here is some information about the primary namespace.
Definition: tb_application_dialog.h:21
SpriteFrame GetSpriteFrame(const tbCore::tbString &spriteSheetName, const tbCore::tbString &spriteName) const
Sprite GetSprite(const tbCore::tbString &spriteSheetName, const tbCore::tbString &spriteName) const
Definition: tb_animated_sprite.h:29
tbCore::uint32 TextureHandle
Definition: tb_texture_manager.h:43
tbCore::uint16 PixelSpace
Definition: tb_texture_manager.h:35
Definition: tb_dynamic_structure.h:57
void AddAnimationSequences(const tbCore::tbString &spriteSheetName, const tbCore::tbString &spriteName, AnimatedSprite &animatedSprite) const
Definition: tb_sprite_sheet.h:33
bool LoadSpriteSheetFromFile(const tbCore::tbString &spriteSheetName, const tbCore::tbString &spriteSheetFile)
std::string tbString
Definition: tb_string.h:335
SpriteManager theSpriteManager
Definition: tb_application_dialog.h:19
Definition: tb_animated_sprite.h:119
Definition: tb_sprite.h:136
Sprite GetSpriteFromFile(const tbCore::tbString &textureFile, const PixelSpace &frameX=0, const PixelSpace &frameY=0, const PixelSpace &frameWidth=0, const PixelSpace &frameHeight=0) const