e2d::core::Rect Class Reference

Inheritance diagram for e2d::core::Rect:

e2d::graphics::Image e2d::graphics::ImageData e2d::graphics::Label e2d::graphics::Sprite e2d::graphics::TileMap e2d::graphics::TTF e2d::graphics::Video e2d::graphics::Window

List of all members.

Detailed Description

In fact, this class is a simple wrapper around SDL_Rect, with some nice constructors and getter and setter methods.

Public Member Functions

 Rect (int x, int y, int w, int h)
 Rect (const Rect &original)
 Copy constructor.
void Add (const Rect &other_rect)
 Sums up both rects.
bool Collide (const Rect &other_rect)
 Tests if two rects are colliding (overlapping).
void Copy (const Rect &other_rect)
 Copy other rect's data to this one.
bool Equals (const Rect &other_rect)
 Compares two rects.
SDL_Rect * GetSDL_Rect (void)
 Getter for the rectangle.
int GetH (void)
 Getter for height.
int GetX (void)
 Getter for X coordinate.
int GetY (void)
 Getter for Y coordinate.
int GetW (void)
 Getter for width.
void Move (int x, int y)
 Adds to the current position.
void Resize (int w, int h)
 Adds to the current dimension.
void SetDimension (int w, int h)
 Sets dimension.
void SetPosition (int x, int y)
 Sets position.
void SetH (int h)
 Setter for height.
void SetX (int x)
 Setter for X coordinate.
void SetY (int y)
 Setter for Y coordinate.
void SetW (int w)
 Setter for width.

Constructor & Destructor Documentation

e2d::core::Rect::Rect ( int  x,
int  y,
int  w,
int  h 

Initializes the rectangle.

x X coordinate of upper-left point.
y Y coordinate of upper-left point.
w Width of the rectangle, in pixels.
h Height of the rectangle, in pixels.

e2d::core::Rect::Rect ( const Rect original  ) 

Makes a copy of another rectangle.

original Rectangle to copy data from.

Member Function Documentation

void e2d::core::Rect::Add ( const Rect other_rect  ) 

Sums up both rects and sets the result to this rect.

other_rect Rect to sum.

bool e2d::core::Rect::Collide ( const Rect other_rect  ) 

Tests if two rects are colliding (overlapping)

other_rect Rect to test against.
true if rects collide, false otherwise.

void e2d::core::Rect::Copy ( const Rect other_rect  ) 

Copies the X, Y, W and H attributes of the other rect into this.

other_rect Rect to copy data from.

bool e2d::core::Rect::Equals ( const Rect other_rect  ) 

Compares two rects.

other_rect Rect to compare to.
true if other_rect is equal to this, false otherwise

SDL_Rect * e2d::core::Rect::GetSDL_Rect ( void   ) 

Getter for the rectangle

Pointer to SDL_Rect (SDL_Rect is part of SDL)

void e2d::core::Rect::Move ( int  x,
int  y 

Adds to the current position.

x Amount to add in the X axis.
y Amount to add in the Y axis.

void e2d::core::Rect::Resize ( int  w,
int  h 

Adds to the current dimension.

w Amount to add to the Width (W)
h Amount to add to the Height (H)

void e2d::core::Rect::SetDimension ( int  w,
int  h 

Modifies W and H coordinates

w New width.
h New height.

void e2d::core::Rect::SetPosition ( int  x,
int  y 

Modifies X and Y coordinates.

x New position in the X axis.
y New position the Y axis.

Generated on Tue Dec 8 10:32:44 2009 for Easy2D by  doxygen 1.5.6