00001 // Filename: charPlacement.cxx 00002 // Created by: drose (16Feb01) 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 #include "charPlacement.h" 00020 #include "charBitmap.h" 00021 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function: CharPlacement::intersects 00025 // Access: Public 00026 // Description: Returns true if the particular position this char 00027 // has been assigned to overlaps the rectangle whose 00028 // top left corner is at x, y and whose size is given by 00029 // x_size, y_size, or false otherwise. 00030 //////////////////////////////////////////////////////////////////// 00031 bool CharPlacement:: 00032 intersects(int x, int y, int x_size, int y_size) const { 00033 int hright = x + x_size; 00034 int hbot = y + y_size; 00035 00036 int mright = _x + _width; 00037 int mbot = _y + _height; 00038 00039 return !(x >= mright || hright <= _x || 00040 y >= mbot || hbot <= _y); 00041 }