Make TextGlyph typed

This commit is contained in:
rdb 2014-09-14 10:34:01 +00:00
parent 1286264952
commit 3b60afb12b
5 changed files with 44 additions and 2 deletions

View File

@ -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();

View File

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

View File

@ -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"

View File

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

View File

@ -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"