TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tb_sprite_map.hpp
1 
9 #ifndef TurtleBrains_SpriteMap_hpp
10 #define TurtleBrains_SpriteMap_hpp
11 
12 #include <turtle_brains/graphics/tb_sprite.hpp>
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 
66  size_t GetIndexCount(void) const;
67 
72  size_t GetColumnCount(void) const;
73 
78  size_t GetRowCount(void) const;
79 
83  PixelSpace GetFrameWidth(void) const;
84 
88  PixelSpace GetFrameHeight(void) const;
89 
93  TextureHandle GetTextureHandle(void) const;
94 
98  void RenderSpritesByIndex(const tbCore::uint16* const spriteArray, const size_t& columnCount, const size_t& rowCount,
99  const tbMath::Vector2& position = tbMath::Vector2::Zero()) const;
100 
101  protected:
102 
103  private:
104  const TextureHandle mTextureHandle;
105  const PixelSpace mTextureWidth; //must come after
106  const PixelSpace mTextureHeight;
107 
108  PixelSpace mFrameWidth;
109  PixelSpace mFrameHeight;
110  PixelSpace mSpacingX;
111  PixelSpace mSpacingY;
112  PixelSpace mOffsetX;
113  PixelSpace mOffsetY;
114  };
115  }; /* namespace Graphics */
116 }; /* namespace TurtleBrains */
117 
119 
120 #endif /* TurtleBrains_SpriteMap_hpp */
Definition: tb_vector.hpp:48
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.hpp:29
uint16_t uint16
Unsigned integer with a size of 16 bits. Supports values from 0 to 65535.
Definition: tb_types.hpp:26
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:21
static Vector2 Zero(void)
Definition: tb_vector.hpp:54
PixelSpace GetFrameWidth(void) const
tbCore::uint16 PixelSpace
Definition: tb_texture_manager.hpp:36
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.hpp: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