From 3b60afb12bd4393e32e69a04a970a8bd9ca01f40 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 14 Sep 2014 10:34:01 +0000 Subject: [PATCH] Make TextGlyph typed --- panda/src/text/config_text.cxx | 4 ++++ panda/src/text/dynamicTextGlyph.cxx | 2 ++ panda/src/text/dynamicTextGlyph.h | 17 +++++++++++++++++ panda/src/text/textGlyph.cxx | 4 +++- panda/src/text/textGlyph.h | 19 ++++++++++++++++++- 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/panda/src/text/config_text.cxx b/panda/src/text/config_text.cxx index 8372aa96a1..a963413467 100644 --- a/panda/src/text/config_text.cxx +++ b/panda/src/text/config_text.cxx @@ -15,9 +15,11 @@ #include "config_text.h" #include "staticTextFont.h" #include "textFont.h" +#include "textGlyph.h" #include "textNode.h" #include "textProperties.h" #include "dynamicTextFont.h" +#include "dynamicTextGlyph.h" #include "dynamicTextPage.h" #include "geomTextGlyph.h" #include "geomTextGlyph.h" @@ -217,11 +219,13 @@ init_libtext() { StaticTextFont::init_type(); TextFont::init_type(); + TextGlyph::init_type(); TextNode::init_type(); TextProperties::init_type(); #ifdef HAVE_FREETYPE DynamicTextFont::init_type(); + DynamicTextGlyph::init_type(); DynamicTextPage::init_type(); GeomTextGlyph::init_type(); GeomTextGlyph::init_type(); diff --git a/panda/src/text/dynamicTextGlyph.cxx b/panda/src/text/dynamicTextGlyph.cxx index 250b8ce677..a63615340c 100644 --- a/panda/src/text/dynamicTextGlyph.cxx +++ b/panda/src/text/dynamicTextGlyph.cxx @@ -28,6 +28,8 @@ #include "renderState.h" #include "config_gobj.h" +TypeHandle DynamicTextGlyph::_type_handle; + //////////////////////////////////////////////////////////////////// // Function: DynamicTextGlyph::Destructor // Access: Public, Virtual diff --git a/panda/src/text/dynamicTextGlyph.h b/panda/src/text/dynamicTextGlyph.h index 217c6430d2..6c8339032e 100644 --- a/panda/src/text/dynamicTextGlyph.h +++ b/panda/src/text/dynamicTextGlyph.h @@ -74,6 +74,23 @@ public: int _margin; PN_stdfloat _top, _left, _bottom, _right; PN_stdfloat _uv_top, _uv_left, _uv_bottom, _uv_right; + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + TextGlyph::init_type(); + register_type(_type_handle, "DynamicTextGlyph", + TextGlyph::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: + static TypeHandle _type_handle; }; #include "dynamicTextGlyph.I" diff --git a/panda/src/text/textGlyph.cxx b/panda/src/text/textGlyph.cxx index f0bda6f96b..7c1c6ff4a6 100644 --- a/panda/src/text/textGlyph.cxx +++ b/panda/src/text/textGlyph.cxx @@ -14,10 +14,12 @@ #include "textGlyph.h" +TypeHandle TextGlyph::_type_handle; + //////////////////////////////////////////////////////////////////// // Function: TextGlyph::Destructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// TextGlyph:: ~TextGlyph() { diff --git a/panda/src/text/textGlyph.h b/panda/src/text/textGlyph.h index 293fb3cc9b..fc321fbaf9 100644 --- a/panda/src/text/textGlyph.h +++ b/panda/src/text/textGlyph.h @@ -28,7 +28,7 @@ // font. This is a piece of renderable geometry of some // kind. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_TEXT TextGlyph : public ReferenceCount { +class EXPCL_PANDA_TEXT TextGlyph : public TypedReferenceCount { public: INLINE TextGlyph(int character); INLINE TextGlyph(int character, const Geom *geom, @@ -50,6 +50,23 @@ protected: CPT(Geom) _geom; CPT(RenderState) _state; PN_stdfloat _advance; + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + TypedReferenceCount::init_type(); + register_type(_type_handle, "TextGlyph", + TypedReferenceCount::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: + static TypeHandle _type_handle; }; #include "textGlyph.I"