7 #include "objectinstance.h"
14 Creates an object consisting of the visual representation of a string. If you
15 derive from Text to customize it, make sure you call Text::setup_render or
16 otherwise bind the appropriate texture.
18 class Text: public ObjectInstance
46 Text(const Font &, const Technique * = 0, Tag = Tag());
48 const Mesh *get_mesh() const { return &mesh; }
50 /** Sets technique to render with, replacing the given texture slot with
51 the font texture. If no texture slot is specified, heuristics are used to
52 choose a suitable one. */
53 void set_technique(const Technique *, Tag = Tag());
55 const Technique *get_technique() const { return object.get_technique(); }
57 /// Sets the string to be displayed.
58 void set_text(const std::string &, StringCodec::Decoder &);
61 void set_text(const std::string &t)
63 typename C::Decoder dec;
67 void set_text(const std::string &t)
68 { set_text<StringCodec::Utf8>(t); }
70 /// Clears the object's contents.
73 /// Sets horizontal and vertical alignment with predefined anchors.
74 void set_alignment(HorizontalAlign, VerticalAlign = BASELINE);
76 /** Sets horizontal and vertical alignment. 0.0 means left or baseline,
77 1.0 means right or top. */
78 void set_alignment(float, float = 0.0f);
80 float get_width() const { return width; }
82 virtual void setup_render(Renderer &, Tag) const;
84 DEPRECATED operator const Object &() const { return object; }