TurtleBrains  0.3.1
High quality, portable, C++ framework for rapid 2D game development.
tb_text.h
1 
11 #ifndef _TurtleBrains_Text_h_
12 #define _TurtleBrains_Text_h_
13 
14 #include "tb_graphic.h"
15 #include "tb_color.h"
16 #include "tb_texture_manager.h" //for PixelSpace definition.
17 #include "../core/tb_noncopyable.h"
18 #include "../core/tb_string.h"
19 
20 namespace tbImplementation
21 {
22  struct TextData;
23 };
24 
25 namespace TurtleBrains
26 {
27  namespace Graphics
28  {
29 
42  class Text : public Graphic, public tbCore::Noncopyable
43  {
44  public:
48  static const float kDefaultFontSize;
49 
54 
67  explicit Text(const tbCore::tbString& text = tb_string(""), const float pointSize = kDefaultFontSize, const tbCore::tbString& fontFilepath = kDefaultFontFile);
68 
74  virtual ~Text(void);
75 
88  void SetText(const tbCore::tbString& text, const float pointSize, const tbCore::tbString& fontFilepath);
89 
99  void SetText(const tbCore::tbString& text);
100 
104  virtual PixelSpace GetPixelWidth(void) const override;
105 
109  virtual PixelSpace GetPixelHeight(void) const override;
110 
111  protected:
116  virtual void OnRender(void) const override;
117 
118  private:
119  tbImplementation::TextData* mTextData;
120  tbCore::tbString mTextFont;
121  tbCore::tbString mTextString;
122  float mTextSize;
123  };
124 
125  }; /* namespace Graphics */
126 }; /* namespace TurtleBrains */
127 
129 
130 #endif /* _TurtleBrains_Text_h_ */
Definition: tb_graphic.h:61
virtual PixelSpace GetPixelWidth(void) const override
virtual void OnRender(void) const override
Give the GameScene and Entities something to display, Text, Sprites and AnimatedSprites help bring th...
virtual PixelSpace GetPixelHeight(void) const override
Definition: tb_noncopyable.h:22
static const float kDefaultFontSize
Definition: tb_text.h:48
Here is some information about the primary namespace.
Definition: tb_application_dialog.h:21
Text(const tbCore::tbString &text=tb_string(""), const float pointSize=kDefaultFontSize, const tbCore::tbString &fontFilepath=kDefaultFontFile)
tbCore::uint16 PixelSpace
Definition: tb_texture_manager.h:35
void SetText(const tbCore::tbString &text, const float pointSize, const tbCore::tbString &fontFilepath)
Definition: tb_text.h:42
static const tbCore::tbString kDefaultFontFile
Definition: tb_text.h:53
#define tb_string(object)
Definition: tb_string.h:28
std::string tbString
Definition: tb_string.h:335
Definition: tb_application_dialog.h:19