X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Frender%2Ftext.h;h=dda0a4f0e8fe2be4c0fa7d5365300e52ddcbcdf5;hp=916d6d7b8d1c02e74dfa2dfca8dfd054c77e79ef;hb=88e67cefcb759902c6bd344373be0b1cd0cf7f6b;hpb=6f39983060a27634c012f66c82fea0d09fea9774 diff --git a/source/render/text.h b/source/render/text.h index 916d6d7b..dda0a4f0 100644 --- a/source/render/text.h +++ b/source/render/text.h @@ -4,16 +4,18 @@ #include "font.h" #include "mesh.h" #include "object.h" +#include "objectinstance.h" #include "technique.h" namespace Msp { namespace GL { /** -Creates an object consisting of the visual representation of a string. Can be -used with an ObjectInstance to further customize the appearance. +Creates an object consisting of the visual representation of a string. If you +derive from Text to customize it, make sure you call Text::setup_render or +otherwise bind the appropriate texture. */ -class Text: public Renderable +class Text: public ObjectInstance { public: enum HorizontalAlign @@ -35,20 +37,20 @@ private: const Font &font; Mesh mesh; Object object; - Technique technique; + Tag texture_slot; float horz_align; float vert_offset; float width; public: - Text(const Font &, const Technique * = 0, const std::string & = std::string()); + Text(const Font &, const Technique * = 0, Tag = Tag()); const Mesh *get_mesh() const { return &mesh; } /** Sets technique to render with, replacing the given texture slot with the font texture. If no texture slot is specified, heuristics are used to choose a suitable one. */ - void set_technique(const Technique *, const std::string & = std::string()); + void set_technique(const Technique *, Tag = Tag()); const Technique *get_technique() const { return object.get_technique(); } @@ -77,9 +79,9 @@ public: float get_width() const { return width; } - virtual void render(Renderer &, Tag = Tag()) const; + virtual void setup_render(Renderer &, Tag) const; - operator const Object &() const { return object; } + DEPRECATED operator const Object &() const { return object; } }; } // namespace GL