TurtleBrains  0.3.1
High quality, portable, C++ framework for rapid 2D game development.
tb_sprite_map.h
1 
9 #ifndef _TurtleBrains_SpriteMap_h_
10 #define _TurtleBrains_SpriteMap_h_
11 
12 #include "tb_sprite.h"
13 
14 namespace TurtleBrains
15 {
16  namespace Graphics
17  {
18 
23  class SpriteMap// : public Graphic
24  {
25  public:
43  SpriteMap(const TextureHandle& textureHandle, const PixelSpace& frameWidth, const PixelSpace& frameHeight,
44  const PixelSpace& spacingX = 0, const PixelSpace& spacingY = 0, const PixelSpace& offsetX = 0, const PixelSpace& offsetY = 0);
45 
50  virtual ~SpriteMap(void);
51 
55  SpriteFrame GetSpriteFrameAtIndex(const size_t& frameIndex) const;
56 
60  SpriteFrame GetSpriteFrameAtLocation(const size_t& frameColumn, const size_t& frameRow) const;
61 
65  size_t GetIndexCount(void) const;
66 
70  size_t GetColumnCount(void) const;
71 
75  size_t GetRowCount(void) const;
76 
80  PixelSpace GetFrameWidth(void) const;
81 
85  PixelSpace GetFrameHeight(void) const;
86 
90  TextureHandle GetTextureHandle(void) const;
91 
95  void RenderSpritesByIndex(const tbCore::uint16* const spriteArray, const size_t& columnCount, const size_t& rowCount,
96  const tbMath::Vector2& position = tbMath::Vector2::Zero()) const;
97 
98  protected:
99 
100  private:
101  const TextureHandle mTextureHandle;
102  const PixelSpace mTextureWidth; //must come after
103  const PixelSpace mTextureHeight;
104 
105  PixelSpace mFrameWidth;
106  PixelSpace mFrameHeight;
107  PixelSpace mSpacingX;
108  PixelSpace mSpacingY;
109  PixelSpace mOffsetX;
110  PixelSpace mOffsetY;
111  };
112  }; /* namespace Graphics */
113 }; /* namespace TurtleBrains */
114 
116 
117 #endif /* _TurtleBrains_SpriteMap_h_ */
Definition: tb_vector.h:47
PixelSpace GetFrameHeight(void) const
SpriteFrame GetSpriteFrameAtIndex(const size_t &frameIndex) const
Give the GameScene and Entities something to display, Text, Sprites and AnimatedSprites help bring th...
TextureHandle GetTextureHandle(void) const
size_t GetIndexCount(void) const
Definition: tb_sprite.h:29
uint16_t uint16
Unsigned integer with a size of 16 bits. Supports values from 0 to 65535.
Definition: tb_types.h:26
Here is some information about the primary namespace.
Definition: tb_application_dialog.h:21
static Vector2 Zero(void)
Definition: tb_vector.h:53
PixelSpace GetFrameWidth(void) const
tbCore::uint32 TextureHandle
Definition: tb_texture_manager.h:43
tbCore::uint16 PixelSpace
Definition: tb_texture_manager.h:35
void RenderSpritesByIndex(const tbCore::uint16 *const spriteArray, const size_t &columnCount, const size_t &rowCount, const tbMath::Vector2 &position=tbMath::Vector2::Zero()) const
Definition: tb_sprite_map.h:23
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)
SpriteFrame GetSpriteFrameAtLocation(const size_t &frameColumn, const size_t &frameRow) const
size_t GetColumnCount(void) const
size_t GetRowCount(void) const