7 #include "objectinstance.h"
13 Creates an object consisting of the visual representation of a string. If you
14 derive from Text to customize it, make sure you call Text::setup_render or
15 otherwise bind the appropriate texture.
17 class Text: public ObjectInstance
40 float horz_align = 0.0f;
41 float vert_offset = 0.0f;
45 Text(const Font &, const Technique * = 0, Tag = Tag());
47 const Mesh *get_mesh() const { return &mesh; }
49 /** Sets technique to render with, replacing the given texture slot with
50 the font texture. If no texture slot is specified, heuristics are used to
51 choose a suitable one. */
52 void set_technique(const Technique *, Tag = Tag());
54 const Technique *get_technique() const { return object.get_technique(); }
56 /// Sets the string to be displayed.
57 void set_text(const std::string &, StringCodec::Decoder &);
60 void set_text(const std::string &t)
62 typename C::Decoder dec;
66 void set_text(const std::string &t)
67 { set_text<StringCodec::Utf8>(t); }
69 /// Clears the object's contents.
72 /// Sets horizontal and vertical alignment with predefined anchors.
73 void set_alignment(HorizontalAlign, VerticalAlign = BASELINE);
75 /** Sets horizontal and vertical alignment. 0.0 means left or baseline,
76 1.0 means right or top. */
77 void set_alignment(float, float = 0.0f);
79 float get_width() const { return width; }
81 virtual void setup_render(Renderer &, Tag) const;
83 DEPRECATED operator const Object &() const { return object; }