X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=blobdiff_plain;f=misc%2Fbuilddeps%2Fwin64%2Fsdl%2Finclude%2FSDL2%2FSDL_rect.h;h=71a4115173ad77cd407cada3a5d8960a1451edd7;hp=0a95a3344958b82eaf7296407c69726503a7ec5d;hb=1e434bee7af23e6dfd2130a8eadd131e5da3d643;hpb=bfdab051f22d11a553b69f28a294cb012b0b6c50 diff --git a/misc/builddeps/win64/sdl/include/SDL2/SDL_rect.h b/misc/builddeps/win64/sdl/include/SDL2/SDL_rect.h index 0a95a334..71a41151 100644 --- a/misc/builddeps/win64/sdl/include/SDL2/SDL_rect.h +++ b/misc/builddeps/win64/sdl/include/SDL2/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2014 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for SDL_rect definition and management functions. */ -#ifndef _SDL_rect_h -#define _SDL_rect_h +#ifndef SDL_rect_h_ +#define SDL_rect_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -40,9 +40,10 @@ extern "C" { #endif /** - * \brief The structure that defines a point + * \brief The structure that defines a point (integer) * * \sa SDL_EnclosePoints + * \sa SDL_PointInRect */ typedef struct SDL_Point { @@ -51,7 +52,20 @@ typedef struct SDL_Point } SDL_Point; /** - * \brief A rectangle, with the origin at the upper left. + * \brief The structure that defines a point (floating point) + * + * \sa SDL_EnclosePoints + * \sa SDL_PointInRect + */ +typedef struct SDL_FPoint +{ + float x; + float y; +} SDL_FPoint; + + +/** + * \brief A rectangle, with the origin at the upper left (integer). * * \sa SDL_RectEmpty * \sa SDL_RectEquals @@ -66,6 +80,28 @@ typedef struct SDL_Rect int w, h; } SDL_Rect; + +/** + * \brief A rectangle, with the origin at the upper left (floating point). + */ +typedef struct SDL_FRect +{ + float x; + float y; + float w; + float h; +} SDL_FRect; + + +/** + * \brief Returns true if point resides inside a rectangle. + */ +SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) +{ + return ( (p->x >= r->x) && (p->x < (r->x + r->w)) && + (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; +} + /** * \brief Returns true if the rectangle has no area. */ @@ -133,6 +169,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * #endif #include "close_code.h" -#endif /* _SDL_rect_h */ +#endif /* SDL_rect_h_ */ /* vi: set ts=4 sw=4 expandtab: */