FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
FIFE::RectType< T > Class Template Reference

#include <rect.h>

Inheritance diagram for FIFE::RectType< T >:
Inheritance graph
Collaboration diagram for FIFE::RectType< T >:
Collaboration graph

Public Member Functions

 RectType (T x=0, T y=0, T w=0, T h=0)
 
template<typename U >
 RectType (const RectType< U > &r)
 
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 int32_t 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 
)
inlineexplicit

Constructor.

Creates a new Rect with the values defaulting to 0.

Definition at line 99 of file rect.h.

template<typename T>
template<typename U >
FIFE::RectType< T >::RectType ( const RectType< U > &  r)
inlineexplicit

Constructor.

Creates a new Rect of type T from the given Rect of type U

Definition at line 107 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 173 of file rect.h.

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
pThe point that is checked.
Returns
True if the point lies inside the rectangle or on one of its borders.

Definition at line 184 of file rect.h.

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

Calculate rectangle intersection in place

Parameters
rectThe 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 192 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
rectThe 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 227 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
rectThe rectangle to which this is compared.
Returns
True only if both rectangle values are all equal.

Definition at line 178 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 168 of file rect.h.

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

Here is the caller graph for this function:

Member Data Documentation


The documentation for this class was generated from the following file: