Public Member Functions | Public Attributes

FIFE::Rect Class Reference

#include <rect.h>

List of all members.

Public Member Functions

 Rect (int x=0, int y=0, unsigned int width=0, unsigned int height=0)
int right () const
int bottom () const
bool operator== (const Rect &rect) const
bool contains (const Point &point) const
bool intersects (const Rect &rect) const
bool intersectInplace (const Rect &rect)

Public Attributes

int x
int y
int w
int h

Detailed Description

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 79 of file rect.h.


Constructor & Destructor Documentation

FIFE::Rect::Rect ( int  x = 0,
int  y = 0,
unsigned int  width = 0,
unsigned int  height = 0 
) [explicit]

Constructor.

Creates a new Rect with the values defaulting to 0.

Definition at line 34 of file rect.cpp.


Member Function Documentation

int FIFE::Rect::bottom (  )  const [inline]

The Y coordinate of the bottom edge.

Definition at line 157 of file rect.h.

References h, and y.

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

Here is the caller graph for this function:

bool FIFE::Rect::contains ( const Point 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 170 of file rect.h.

References h, w, x, and y.

bool FIFE::Rect::intersectInplace ( const Rect 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 178 of file rect.h.

References h, w, x, and y.

bool FIFE::Rect::intersects ( const Rect 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 214 of file rect.h.

References h, w, x, and y.

bool FIFE::Rect::operator== ( const Rect 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 163 of file rect.h.

References h, w, x, and y.

int FIFE::Rect::right (  )  const [inline]

The X coordinate of the right edge.

Definition at line 152 of file rect.h.

References w, and x.

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 files: