Browse Source

Make TextGlyph typed

rdb 11 years ago
parent
commit
3b60afb12b

+ 4 - 0
panda/src/text/config_text.cxx

@@ -15,9 +15,11 @@
 #include "config_text.h"
 #include "config_text.h"
 #include "staticTextFont.h"
 #include "staticTextFont.h"
 #include "textFont.h"
 #include "textFont.h"
+#include "textGlyph.h"
 #include "textNode.h"
 #include "textNode.h"
 #include "textProperties.h"
 #include "textProperties.h"
 #include "dynamicTextFont.h"
 #include "dynamicTextFont.h"
+#include "dynamicTextGlyph.h"
 #include "dynamicTextPage.h"
 #include "dynamicTextPage.h"
 #include "geomTextGlyph.h"
 #include "geomTextGlyph.h"
 #include "geomTextGlyph.h"
 #include "geomTextGlyph.h"
@@ -217,11 +219,13 @@ init_libtext() {
 
 
   StaticTextFont::init_type();
   StaticTextFont::init_type();
   TextFont::init_type();
   TextFont::init_type();
+  TextGlyph::init_type();
   TextNode::init_type();
   TextNode::init_type();
   TextProperties::init_type();
   TextProperties::init_type();
 
 
 #ifdef HAVE_FREETYPE
 #ifdef HAVE_FREETYPE
   DynamicTextFont::init_type();
   DynamicTextFont::init_type();
+  DynamicTextGlyph::init_type();
   DynamicTextPage::init_type();
   DynamicTextPage::init_type();
   GeomTextGlyph::init_type();
   GeomTextGlyph::init_type();
   GeomTextGlyph::init_type();
   GeomTextGlyph::init_type();

+ 2 - 0
panda/src/text/dynamicTextGlyph.cxx

@@ -28,6 +28,8 @@
 #include "renderState.h"
 #include "renderState.h"
 #include "config_gobj.h"
 #include "config_gobj.h"
 
 
+TypeHandle DynamicTextGlyph::_type_handle;
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: DynamicTextGlyph::Destructor
 //     Function: DynamicTextGlyph::Destructor
 //       Access: Public, Virtual
 //       Access: Public, Virtual

+ 17 - 0
panda/src/text/dynamicTextGlyph.h

@@ -74,6 +74,23 @@ public:
   int _margin;
   int _margin;
   PN_stdfloat _top, _left, _bottom, _right;
   PN_stdfloat _top, _left, _bottom, _right;
   PN_stdfloat _uv_top, _uv_left, _uv_bottom, _uv_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"
 #include "dynamicTextGlyph.I"

+ 3 - 1
panda/src/text/textGlyph.cxx

@@ -14,10 +14,12 @@
 
 
 #include "textGlyph.h"
 #include "textGlyph.h"
 
 
+TypeHandle TextGlyph::_type_handle;
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: TextGlyph::Destructor
 //     Function: TextGlyph::Destructor
 //       Access: Public
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 TextGlyph::
 TextGlyph::
 ~TextGlyph() {
 ~TextGlyph() {

+ 18 - 1
panda/src/text/textGlyph.h

@@ -28,7 +28,7 @@
 //               font.  This is a piece of renderable geometry of some
 //               font.  This is a piece of renderable geometry of some
 //               kind.
 //               kind.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA_TEXT TextGlyph : public ReferenceCount {
+class EXPCL_PANDA_TEXT TextGlyph : public TypedReferenceCount {
 public:
 public:
   INLINE TextGlyph(int character);
   INLINE TextGlyph(int character);
   INLINE TextGlyph(int character, const Geom *geom, 
   INLINE TextGlyph(int character, const Geom *geom, 
@@ -50,6 +50,23 @@ protected:
   CPT(Geom) _geom;
   CPT(Geom) _geom;
   CPT(RenderState) _state;
   CPT(RenderState) _state;
   PN_stdfloat _advance;
   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"
 #include "textGlyph.I"