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