TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tbx_nine_slice.hpp
1 
9 #ifndef TurtleBrainsExpress_NineSlice_hpp
10 #define TurtleBrainsExpress_NineSlice_hpp
11 
12 #include <turtle_brains/graphics/tb_graphic.hpp>
13 #include <turtle_brains/graphics/tb_sprite.hpp>
14 
15 #include <array>
16 
17 namespace TurtleBrainsExpress
18 {
19  namespace Graphics
20  {
21 
26  {
27  public:
46  explicit NineSlice(const std::array<tbGraphics::Sprite, 9> sprites, tbGraphics::PixelSpace width, tbGraphics::PixelSpace height);
47 
51  explicit NineSlice(const tbCore::tbString& spriteSheetName, const tbCore::tbString& spriteName,
53 
57  virtual ~NineSlice(void);
58 
59  virtual tbGraphics::PixelSpace GetPixelWidth(void) const override { return mWidth; }
60  virtual tbGraphics::PixelSpace GetPixelHeight(void) const override { return mHeight; }
61 
62  protected:
63  virtual void OnRender(void) const override;
64 
65  private:
66  tbGraphics::PixelSpace MinimumWidth(void) const;
67  tbGraphics::PixelSpace MinimumHeight(void) const;
68 
69  std::array<tbGraphics::Sprite, 9> mSprites;
71  tbGraphics::PixelSpace mHeight;
72  };
73 
74  }; /* namespace Graphics */
75 }; /* namespace TurtleBrainsExpress */
76 
78 
79 #endif /* TurtleBrainsExpress_NineSlice_hpp */
Definition: tb_graphic.hpp:61
virtual void OnRender(void) const override
Definition: tbx_nine_slice.hpp:19
A collection of objects and functions to express games quickly.
NineSlice(const std::array< tbGraphics::Sprite, 9 > sprites, tbGraphics::PixelSpace width, tbGraphics::PixelSpace height)
virtual tbGraphics::PixelSpace GetPixelHeight(void) const override
Definition: tbx_nine_slice.hpp:60
tbCore::uint16 PixelSpace
Definition: tb_texture_manager.hpp:36
virtual tbGraphics::PixelSpace GetPixelWidth(void) const override
Definition: tbx_nine_slice.hpp:59
std::string tbString
Definition: tb_string.hpp:335
Definition: tbx_nine_slice.hpp:25