FIFE::RectType< T > Class Template Reference

#include <rect.h>

Inheritance diagram for FIFE::RectType< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 RectType (T x=0, T y=0, T w=0, T h=0)
right () const
bottom () const
bool operator== (const RectType< T > &rect) const
bool contains (const PointType2D< T > &point) const
bool intersects (const RectType< T > &rect) const
bool intersectInplace (const RectType< T > &rect)

Public Attributes

x
y
w
h

Detailed Description

template<typename T>
class FIFE::RectType< T >

A Rectangle on screen.

This is a small helper class used for screen coordinate arithmetics. The same thoughts reasong using int as value type as in Point apply.

See also:
Point

Definition at line 80 of file rect.h.


Constructor & Destructor Documentation

template<typename T>
FIFE::RectType< T >::RectType ( x = 0,
y = 0,
w = 0,
h = 0 
) [inline, explicit]

Constructor.

Creates a new Rect with the values defaulting to 0.

Definition at line 99 of file rect.h.


Member Function Documentation

template<typename T >
T FIFE::RectType< T >::bottom (  )  const [inline]

The Y coordinate of the bottom edge.

Definition at line 162 of file rect.h.

References FIFE::RectType< T >::h, and FIFE::RectType< T >::y.

Referenced by FIFE::SDLImage::render(), and FIFE::GLImage::render().

Here is the caller graph for this function:

template<typename T>
bool FIFE::RectType< T >::contains ( const PointType2D< T > &  point  )  const [inline]

Checks whether a rectangle contains a Point.

Parameters:
p The point that is checked.
Returns:
True if the point lies inside the rectangle or on one of its borders.

Definition at line 173 of file rect.h.

References FIFE::RectType< T >::h, FIFE::RectType< T >::w, FIFE::RectType< T >::x, and FIFE::RectType< T >::y.

template<typename T>
bool FIFE::RectType< T >::intersectInplace ( const RectType< T > &  rect  )  [inline]

Calculate rectangle intersection in place

Parameters:
rect The other rectangle that is checked.
Returns:
True, if and only if both rectangles have some covered area in common. This includes edges that cover each other.

Definition at line 181 of file rect.h.

References FIFE::RectType< T >::h, FIFE::RectType< T >::w, FIFE::RectType< T >::x, and FIFE::RectType< T >::y.

template<typename T>
bool FIFE::RectType< T >::intersects ( const RectType< T > &  rect  )  const [inline]

Check whether two rectangles share some area.

Parameters:
rect The other rectangle that is checked.
Returns:
True, if and only if both rectangles have some covered area in common. This includes edges that cover each other.
Note:
This operation is commutative.

Definition at line 216 of file rect.h.

References FIFE::RectType< T >::h, FIFE::RectType< T >::w, FIFE::RectType< T >::x, and FIFE::RectType< T >::y.

template<typename T>
bool FIFE::RectType< T >::operator== ( const RectType< T > &  rect  )  const [inline]

Equivalence operator.

Parameters:
rect The rectangle to which this is compared.
Returns:
True only if both rectangle values are all equal.

Definition at line 167 of file rect.h.

References FIFE::RectType< T >::h, FIFE::RectType< T >::w, FIFE::RectType< T >::x, and FIFE::RectType< T >::y.

template<typename T >
T FIFE::RectType< T >::right (  )  const [inline]

The X coordinate of the right edge.

Definition at line 157 of file rect.h.

References FIFE::RectType< T >::w, and FIFE::RectType< T >::x.

Referenced by FIFE::SDLImage::render(), and FIFE::GLImage::render().

Here is the caller graph for this function:


Member Data Documentation

template<typename T>
T FIFE::RectType< T >::h
template<typename T>
T FIFE::RectType< T >::w
template<typename T>
T FIFE::RectType< T >::x
template<typename T>
T FIFE::RectType< T >::y

The documentation for this class was generated from the following file:
Generated on Wed Nov 23 13:05:07 2011 for FIFE by  doxygen 1.6.3