rectfunctions.h File Reference

Contains methods for calculating with rects. More...

Go to the source code of this file.

Functions

DECLSPEC bool pointInRect (const SDL_Rect &r, int x, int y)
DECLSPEC void setRectEmpty (SDL_Rect &r)
DECLSPEC bool isRectEmpty (const SDL_Rect &r)
DECLSPEC void offsetRect (SDL_Rect &r, int dx, int dy)
DECLSPEC void setRect (SDL_Rect &r, int x, int y, int w, int h)
DECLSPEC void inflateRect (SDL_Rect &r, int dx, int dy)
DECLSPEC void intersectRect (SDL_Rect &r, const SDL_Rect &r2)


Detailed Description

Contains methods for calculating with rects.

Required header file:

 #include <functions.h> 

Function Documentation

DECLSPEC void inflateRect ( SDL_Rect &  r,
int  dx,
int  dy 
)

Resizes a rect, the rect's center will not change.

Parameters:
r The rect to resize
dx The value to change the left and right borders, negative to make it smaller
dy The value to change the top and bottom borders, negative to make it smaller

DECLSPEC void intersectRect ( SDL_Rect &  r,
const SDL_Rect &  r2 
)

Intersects two rects and assignes the intersected area to r.

Parameters:
r One rect, the result will be assigned to this
r2 The other rect, is stays unaffected

DECLSPEC bool isRectEmpty ( const SDL_Rect &  r  ) 

Prooves whether a rect is empty or not

Parameters:
r The rect to proove
Returns:
true, if w is zero and x is -1, false otherwise

DECLSPEC void offsetRect ( SDL_Rect &  r,
int  dx,
int  dy 
)

Moves a rect

Parameters:
r The rect to move
dx The distance to move in x-direction, negative to move to the left
dy The distance to move in y-direction, negative to move to the top

DECLSPEC bool pointInRect ( const SDL_Rect &  r,
int  x,
int  y 
)

Prooves whether a point is inside a rect, or not.

Parameters:
r The rect
x The x coordinate of the point
y The y coordinate of the point
Returns:
true, if the point is inside the rect, false if not

DECLSPEC void setRect ( SDL_Rect &  r,
int  x,
int  y,
int  w,
int  h 
)

Sets all of the rect's data.

Parameters:
r A reference to the rect
x the x coordinate
y the y coordinate
w the width
h the height

DECLSPEC void setRectEmpty ( SDL_Rect &  r  ) 

Makes a rect invalid by setting x and y to -1 and w and h to 0.

Parameters:
r The rect to empty


Generated on Wed May 9 17:36:04 2007 for netrinjo by  doxygen 1.5.1