Aether3D Game Engine
All Classes Namespaces Functions Variables Enumerations Pages
TextRendererComponent.hpp
1 #ifndef TEXT_RENDERER_H
2 #define TEXT_RENDERER_H
3 
4 #include <type_traits>
5 #include <string>
6 
7 namespace ae3d
8 {
11  {
12  public:
14  enum class ShaderType { Sprite, SDF };
15 
18 
21 
24 
27 
29  void SetColor( const struct Vec4& color );
30 
32  void SetFont( class Font* font );
33 
35  void SetText( const char* text );
36 
38  void SetShader( ShaderType shaderType );
39 
41  std::string GetSerialized() const;
42 
43  private:
44  friend class GameObject;
45  friend class Scene;
46 
48  static int Type() { return 4; }
49 
51  static unsigned New();
52 
54  static TextRendererComponent* Get( unsigned index );
55 
57  void Render( const float* projectionModelMatrix );
58 
59  struct Impl;
60  Impl& m() { return reinterpret_cast<Impl&>(_storage); }
61  Impl const& m() const { return reinterpret_cast<Impl const&>(_storage); }
62 
63  static const std::size_t StorageSize = 1384;
64  static const std::size_t StorageAlign = 16;
65 
66  std::aligned_storage<StorageSize, StorageAlign>::type _storage;
67  };
68 }
69 
70 #endif
Contains glyphs loaded from AngelCode BMFont files. For Mac there is a compatible program called BMGl...
Definition: Font.hpp:12
Definition: AudioClip.hpp:4
ShaderType
Shader type for rendering text.
Definition: TextRendererComponent.hpp:14
void SetShader(ShaderType shaderType)
4-component vector.
Definition: Vec3.hpp:351
Contains text loaded from AngelCode BMFont: http://www.angelcode.com/products/bmfont/.
Definition: TextRendererComponent.hpp:10
void SetColor(const struct Vec4 &color)
void SetFont(class Font *font)
void SetText(const char *text)
TextRendererComponent()
Constructor.
TextRendererComponent & operator=(const TextRendererComponent &other)
GameObject is composed of components that define its behavior.
Definition: GameObject.hpp:9
std::string GetSerialized() const
~TextRendererComponent()
Destructor.
Contains game objects in a transform hierarchy.
Definition: Scene.hpp:16