Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Rect Class Reference

#include <Rect.h>

Inheritance diagram for Rect:

Inheritance graph
[legend]
List of all members.

Public Methods

 Rect ()
 Rect (Vec2D &upperLeft, Vec2D &lowerRight)
virtual ~Rect ()
virtual void setBounds (const Vec2D &upperLeft, const Vec2D &lowerRight)
virtual const vector< Vec2D > & bounds () const
 returns the bounding points, pts[0] is upper left, pts[1] is lower right

virtual bool contains (const Vec2D &pt) const

Protected Attributes

Vec2D m_ul
Vec2D m_lr
vector< Vec2Dm_bounds

Constructor & Destructor Documentation

Rect::Rect  
 

Definition at line 24 of file Rect.cpp.

References m_bounds, m_lr, m_ul, and Vec2D.

00024            : m_ul(Vec2D(0.0f, 0.0f)), m_lr(Vec2D(0.0f, 0.0f)) 
00025 {
00026   m_bounds.resize(2);
00027   m_bounds[0] = m_ul;
00028   m_bounds[1] = m_lr;
00029 }

Rect::Rect Vec2D   upperLeft,
Vec2D   lowerRight
 

Definition at line 31 of file Rect.cpp.

References m_bounds, m_lr, and m_ul.

00031                                : m_ul(ul), m_lr(lr) 
00032 {
00033   m_bounds.resize(2);
00034   m_bounds[0] = m_ul;
00035   m_bounds[1] = m_lr;
00036 }

Rect::~Rect   [virtual]
 

Definition at line 38 of file Rect.cpp.

00039 {
00040 }


Member Function Documentation

const vector< Vec2D > & Rect::bounds   const [inline, virtual]
 

returns the bounding points, pts[0] is upper left, pts[1] is lower right

Definition at line 51 of file Rect.h.

References m_bounds.

Referenced by Icon::drawOutline(), HUD::render(), HUD::translateMiniMapToWorld(), HUD::translateWorldToMiniMap(), and Map::WorldMap::worldToGridCoord().

00051 { return m_bounds; }

bool Rect::contains const Vec2D   pt const [virtual]
 

Definition at line 42 of file Rect.cpp.

References m_lr, and m_ul.

Referenced by Icon::drawHelpString(), HUD::isButtonStopClicked(), MilitaryUnit::move(), Overhead::overheadRender(), HUD::processMiniMapInput(), Overhead::processOverheadInput(), HUD::processOverheadInput(), and HUD::render().

00043 {
00044   return pt.x >= m_ul.x && pt.y >= m_ul.y && pt.x <= m_lr.x && pt.y <= m_lr.y;
00045 }

void Rect::setBounds const Vec2D   upperLeft,
const Vec2D   lowerRight
[inline, virtual]
 

Reimplemented in Icon.

Definition at line 45 of file Rect.h.

References m_bounds, m_lr, and m_ul.

Referenced by Map::createWorldMap(), and HUD::init().

00046 { 
00047   m_bounds[0] = m_ul = ul; 
00048   m_bounds[1] = m_lr = lr; 
00049 }


Member Data Documentation

vector<Vec2D> Rect::m_bounds [protected]
 

Definition at line 42 of file Rect.h.

Referenced by bounds(), Rect(), setBounds(), and Icon::setBounds().

Vec2D Rect::m_lr [protected]
 

Definition at line 41 of file Rect.h.

Referenced by contains(), Icon::Icon(), Rect(), setBounds(), and Icon::setBounds().

Vec2D Rect::m_ul [protected]
 

Definition at line 40 of file Rect.h.

Referenced by contains(), Icon::Icon(), Rect(), setBounds(), and Icon::setBounds().


The documentation for this class was generated from the following files:
Generated on Wed Apr 23 05:52:12 2003 for Modern Warfare by doxygen1.3-rc2