Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Rect Class Reference
[Glue-logic objects]

Convenience wrapper for SDL_Rect.

#include <rect.h>

List of all members.

Public Member Functions

 Rect ()
 Default constructor - sets everything to 0.

 Rect (SDL_Rect rect)
 Copy constructor.

 Rect (Sint16 xin, Sint16 yin, Uint16 win, Uint16 hin)
 Constructor to set all values in traditional fashion.

 Rect (SfxpCoord coord, Uint16 win, Uint16 hin)
 Constructor that takes fixed-point coordinates, and ordinary h/w.

Rect Set (SDL_Rect r)
 Copies r.

Rect operator= (SDL_Rect r)
 Copies r.

Rect Set (Sint16 xin, Sint16 yin, Uint16 win, Uint16 hin)
 Sets all members of SDL_Rect.

Rect MoveTo (Sint16 xin, Sint16 yin)
 Changes x and y without changing w/h.

Rect Resize (Uint16 win, Uint16 hin)
 Resizes the rectangle without moving it.

Rect operator+= (const SfxpCoord coord)
 Increments x and y amount specified by fixed point coord.

Rect operator-= (const SfxpCoord coord)
 Decrements x and y amount specified by fixed point coord.

bool operator== (const Rect &rect)
 Returns true of the rectangles are identical, false if not.

bool operator!= (const Rect &rect)
 Returns false if the rectangles are equal, true if non-equal.

int LastX ()
 Returns the last valid X pixel position in the rectangle.

int LastY ()
 Returns the last valid Y pixel position in the rectangle.

bool Intersect (SDL_Rect &r, SDL_Rect rect) const
 Calculates intersection of the object and 'rect', result in r.

bool Overlaps (SDL_Rect rect) const
 Returns true if rect overlaps with the local object.

void Draw (SDL_Surface *surf, Uint8 r, Uint8 g, Uint8 b)
 Fills the area on screen specified by the object with rgb color.

void Update (SDL_Surface *screen)
 Updates the rect's area on the screen.

int Area () const
 Returns the calculated area of the object.

RectNormalize ()
 Clips off portions of rect with negative coordinates.

bool Merge (SDL_Rect r)
 Attempts to merge this rect with the other if the resulting area is smaller.

int Print (FILE *fp=stderr) const
 Prints stats on this object to specified stream.

Rect Shrink (int border=1)
 Shrinks the rect's borders by n pixels.


The documentation for this class was generated from the following files:
Generated on Sat Oct 11 13:19:34 2003 for Spritelib by doxygen 1.3.4