include/SDL_rect.h
changeset 8930 d000e6339d41
parent 8149 681eb46b8ac4
child 8943 a743e8b89e72
     1.1 --- a/include/SDL_rect.h	Sat May 24 18:23:56 2014 -0400
     1.2 +++ b/include/SDL_rect.h	Tue May 27 00:26:47 2014 -0400
     1.3 @@ -43,6 +43,7 @@
     1.4   *  \brief  The structure that defines a point
     1.5   *
     1.6   *  \sa SDL_EnclosePoints
     1.7 + *  \sa SDL_PointInRect
     1.8   */
     1.9  typedef struct SDL_Point
    1.10  {
    1.11 @@ -67,6 +68,15 @@
    1.12  } SDL_Rect;
    1.13  
    1.14  /**
    1.15 + *  \brief Returns true if point resides inside a rectangle.
    1.16 + */
    1.17 +SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
    1.18 +{
    1.19 +    return ( (p->x >= r->x) && (p->x < (r->x + r->w)) &&
    1.20 +             (p->y >= r->y) && (p->y < (r->y + r->h)) );
    1.21 +}
    1.22 +
    1.23 +/**
    1.24   *  \brief Returns true if the rectangle has no area.
    1.25   */
    1.26  SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)