include/SDL_rect.h
changeset 8930 d000e6339d41
parent 8149 681eb46b8ac4
child 8943 a743e8b89e72
equal deleted inserted replaced
8929:7b459b49fa92 8930:d000e6339d41
    41 
    41 
    42 /**
    42 /**
    43  *  \brief  The structure that defines a point
    43  *  \brief  The structure that defines a point
    44  *
    44  *
    45  *  \sa SDL_EnclosePoints
    45  *  \sa SDL_EnclosePoints
       
    46  *  \sa SDL_PointInRect
    46  */
    47  */
    47 typedef struct SDL_Point
    48 typedef struct SDL_Point
    48 {
    49 {
    49     int x;
    50     int x;
    50     int y;
    51     int y;
    63 typedef struct SDL_Rect
    64 typedef struct SDL_Rect
    64 {
    65 {
    65     int x, y;
    66     int x, y;
    66     int w, h;
    67     int w, h;
    67 } SDL_Rect;
    68 } SDL_Rect;
       
    69 
       
    70 /**
       
    71  *  \brief Returns true if point resides inside a rectangle.
       
    72  */
       
    73 SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
       
    74 {
       
    75     return ( (p->x >= r->x) && (p->x < (r->x + r->w)) &&
       
    76              (p->y >= r->y) && (p->y < (r->y + r->h)) );
       
    77 }
    68 
    78 
    69 /**
    79 /**
    70  *  \brief Returns true if the rectangle has no area.
    80  *  \brief Returns true if the rectangle has no area.
    71  */
    81  */
    72 SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
    82 SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)