Panda3D
 All Classes Functions Variables Enumerations
dynamicTextGlyph.I
00001 // Filename: dynamicTextGlyph.I
00002 // Created by:  drose (09Feb02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 
00017 ////////////////////////////////////////////////////////////////////
00018 //     Function: DynamicTextGlyph::Constructor
00019 //       Access: Public
00020 //  Description: 
00021 ////////////////////////////////////////////////////////////////////
00022 INLINE DynamicTextGlyph::
00023 DynamicTextGlyph(int character, DynamicTextPage *page, int x, int y,
00024                  int x_size, int y_size, int margin) :
00025   TextGlyph(character),
00026   _page(page),
00027   _x(x), _y(y),
00028   _x_size(x_size), _y_size(y_size),
00029   _margin(margin)
00030 {
00031   _geom_count = 0;
00032 }
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //     Function: DynamicTextGlyph::Constructor
00036 //       Access: Public
00037 //  Description: This constructor makes an empty glyph, whose only
00038 //               purpose is to remember its width.  It has no bitmap
00039 //               and no Geom.
00040 ////////////////////////////////////////////////////////////////////
00041 INLINE DynamicTextGlyph::
00042 DynamicTextGlyph(int character, PN_stdfloat advance) :
00043   TextGlyph(character),
00044   _page((DynamicTextPage *)NULL),
00045   _x(0), _y(0),
00046   _x_size(0), _y_size(0),
00047   _margin(0)
00048 {
00049   _advance = advance;
00050   _geom_count = 1;
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function: DynamicTextGlyph::Copy Constructor
00055 //       Access: Private
00056 //  Description: Copying DynamicTextGlyph objects is not allowed.
00057 ////////////////////////////////////////////////////////////////////
00058 INLINE DynamicTextGlyph::
00059 DynamicTextGlyph(const DynamicTextGlyph &) :
00060   TextGlyph(0)
00061 {
00062   nassertv(false);
00063 }
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 //     Function: DynamicTextGlyph::Copy Assignment Operator
00067 //       Access: Private
00068 //  Description: Copying DynamicTextGlyph objects is not allowed.
00069 ////////////////////////////////////////////////////////////////////
00070 INLINE void DynamicTextGlyph::
00071 operator = (const DynamicTextGlyph &) {
00072   nassertv(false);
00073 }
00074 
00075 ////////////////////////////////////////////////////////////////////
00076 //     Function: DynamicTextGlyph::intersects
00077 //       Access: Public
00078 //  Description: Returns true if the particular position this glyph
00079 //               has been assigned to overlaps the rectangle whose
00080 //               top left corner is at x, y and whose size is given by
00081 //               x_size, y_size, or false otherwise.
00082 ////////////////////////////////////////////////////////////////////
00083 INLINE bool DynamicTextGlyph::
00084 intersects(int x, int y, int x_size, int y_size) const {
00085   int hright = x + x_size;
00086   int hbot = y + y_size;
00087 
00088   int mright = _x + _x_size;
00089   int mbot = _y + _y_size;
00090 
00091   return !(x >= mright || hright <= _x ||
00092            y >= mbot || hbot <= _y);
00093 }
 All Classes Functions Variables Enumerations