Text.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "TextLayout.hpp"
4 #include "../Elements/TranslucentElem.hpp"
5 #include "../Elements/Elem.hpp"
6 #include "../Elements/ElementRenderer.hpp"
8 
9 namespace iv
10 {
11 
16 class Text : public Elem, public TextSegment, public TranslucentElem, public Renderable
17 {
18 public:
20 using Elem::instance;
21  Text( Instance * inst );
22 
23  void status( iv::TableDebugView * view );
24 
25 // initialization parameters
30  //DirtyAttr< bool > attr_fixedAllowed;
31 
32 // utils
33  // Elem
34  Text * enabled( bool );
35 
36  // TranslucentElem
37  Text * preblend( float4 val );
38  Text * translucent( bool val );
39 
40  // Text
41  Text * text( std::string const & );
42  Text * font( ResourcePath const & );
43  Text * fontSize( float );
44  Text * color( float4 );
45  //Text * fixedAllowed( bool );
46 
47 //
49 
50 protected:
51 // Elem
52  virtual void first_pass_impl( ElementRenderer * ) override;
53  virtual void second_pass_impl( ElementRenderer * ) override;
54 
55 private:
56 // TextSegment
57  virtual FontMesh::Geometry geometry_Compute( FontMesh::Location const & location ) override;
58 
59 // Renderable
60  virtual void render( CameraState const & camera, std::optional< float > depth_override ) override;
61 
62 private:
63  FontMesh mesh;
64  Heap heap;
65 };
66 
67 
68 }