From 7810aff393f0e33d1e79153f1e12fe89726e9fc4 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 4 May 2001 05:42:36 +0000 Subject: [PATCH] *** empty log message *** --- panda/src/collide/collisionPolygon.cxx | 3 ++- panda/src/framework/framework.cxx | 9 +++++---- panda/src/gui/guiLabel.cxx | 2 +- panda/src/gui/guiLabel.h | 3 ++- panda/src/text/textNode.I | 15 +++++++++++++++ panda/src/text/textNode.h | 1 + 6 files changed, 26 insertions(+), 7 deletions(-) diff --git a/panda/src/collide/collisionPolygon.cxx b/panda/src/collide/collisionPolygon.cxx index adb56ab206..f8c602f55d 100644 --- a/panda/src/collide/collisionPolygon.cxx +++ b/panda/src/collide/collisionPolygon.cxx @@ -617,6 +617,7 @@ setup_points(const LPoint3f *begin, const LPoint3f *end) { nassertv(_points.size() >= 3); #ifndef NDEBUG + /* // Now make sure the points define a convex polygon. if (is_concave()) { collide_cat.error() << "Invalid concave CollisionPolygon defined:\n"; @@ -627,8 +628,8 @@ setup_points(const LPoint3f *begin, const LPoint3f *end) { collide_cat.error(false) << " normal " << normal << " with length " << normal.length() << "\n"; _points.clear(); - nassertv(false); } + */ #endif // Now average up all the points to get the median. This is the diff --git a/panda/src/framework/framework.cxx b/panda/src/framework/framework.cxx index 8845eeefe2..9f7ff195e8 100644 --- a/panda/src/framework/framework.cxx +++ b/panda/src/framework/framework.cxx @@ -140,7 +140,7 @@ RenderRelation *framerate_arc = (RenderRelation*)0L; PT_NamedNode framerate_node; PT(GraphicsLayer) framerate_layer; -PT_Node framerate_font; +PT(TextFont) framerate_font; PT(TextNode) framerate_text; Loader loader; @@ -502,9 +502,10 @@ void setup_framerate(void) { dr->set_camera(cam2d); // load the font - framerate_font = loader.load_sync("cmtt12"); + PT_Node font_model = loader.load_sync("cmtt12"); - if (framerate_font != (NamedNode *)0L) { + if (font_model != (NamedNode *)0L) { + framerate_font = new TextFont(font_model); framerate_text = new TextNode("framerate_text"); new RenderRelation(framerate_node, framerate_text); @@ -512,7 +513,7 @@ void setup_framerate(void) { LMatrix4f::translate_mat(-0.95, 0.0, 0.95); framerate_text->set_transform(mat); - framerate_text->set_font(framerate_font.p()); + framerate_text->set_font(framerate_font); framerate_text->set_card_color(0.5, 0.5, 0.5, 0.5); framerate_text->set_card_as_margin(0.5, 0.5, 0.2, 0.2); framerate_text->set_frame_color(1., 0., 0., 1.); diff --git a/panda/src/gui/guiLabel.cxx b/panda/src/gui/guiLabel.cxx index d5e225c542..13587e1bec 100644 --- a/panda/src/gui/guiLabel.cxx +++ b/panda/src/gui/guiLabel.cxx @@ -207,7 +207,7 @@ GuiLabel* GuiLabel::make_simple_texture_label(Texture* texture) { return ret; } -GuiLabel* GuiLabel::make_simple_text_label(const string& text, Node* font, +GuiLabel* GuiLabel::make_simple_text_label(const string& text, TextFont* font, Texture* tex) { GuiLabel* ret = new GuiLabel(); ret->_type = SIMPLE_TEXT; diff --git a/panda/src/gui/guiLabel.h b/panda/src/gui/guiLabel.h index 80a679f3cc..8dfd1a8da2 100644 --- a/panda/src/gui/guiLabel.h +++ b/panda/src/gui/guiLabel.h @@ -19,6 +19,7 @@ // label-ish behavior for GUI objects (labels, buttons, rollovers) class GuiManager; +class TextFont; class EXPCL_PANDA GuiLabel : public TypedReferenceCount { PUBLISHED: @@ -70,7 +71,7 @@ PUBLISHED: virtual ~GuiLabel(void); static GuiLabel* make_simple_texture_label(Texture*); - static GuiLabel* make_simple_text_label(const string&, Node*, + static GuiLabel* make_simple_text_label(const string&, TextFont*, Texture* = (Texture*)0L); static GuiLabel* make_simple_card_label(void); static GuiLabel* make_null_label(void); diff --git a/panda/src/text/textNode.I b/panda/src/text/textNode.I index c833dc2120..c811736297 100644 --- a/panda/src/text/textNode.I +++ b/panda/src/text/textNode.I @@ -73,6 +73,21 @@ thaw() { return _freeze_level; } +//////////////////////////////////////////////////////////////////// +// Function: TextNode::set_font +// Access: Published +// Description: Sets the font that will be used when making text. +//////////////////////////////////////////////////////////////////// +INLINE void TextNode:: +set_font(Node *font_node) { + if (font_node == (Node *)NULL) { + _font = (TextFont *)NULL; + } else { + _font = new TextFont(font_node); + } + rebuild(true); +} + //////////////////////////////////////////////////////////////////// // Function: TextNode::set_font // Access: Published diff --git a/panda/src/text/textNode.h b/panda/src/text/textNode.h index 4c1e3b9c6d..e16ecde596 100644 --- a/panda/src/text/textNode.h +++ b/panda/src/text/textNode.h @@ -46,6 +46,7 @@ PUBLISHED: INLINE int get_freeze_level() const; INLINE int thaw(); + INLINE void set_font(Node *font_node); INLINE void set_font(TextFont *font); INLINE TextFont *get_font() const;