mirror of
https://github.com/ioquake/ioq3.git
synced 2025-05-30 00:20:59 +00:00
Update SDL2 to 2.0.16
This commit is contained in:
parent
0b45535613
commit
e987a81edf
88 changed files with 9944 additions and 5114 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@ -40,10 +40,10 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/**
|
||||
* \brief The structure that defines a point (integer)
|
||||
* The structure that defines a point (integer)
|
||||
*
|
||||
* \sa SDL_EnclosePoints
|
||||
* \sa SDL_PointInRect
|
||||
* \sa SDL_EnclosePoints
|
||||
* \sa SDL_PointInRect
|
||||
*/
|
||||
typedef struct SDL_Point
|
||||
{
|
||||
|
@ -52,10 +52,10 @@ typedef struct SDL_Point
|
|||
} SDL_Point;
|
||||
|
||||
/**
|
||||
* \brief The structure that defines a point (floating point)
|
||||
* The structure that defines a point (floating point)
|
||||
*
|
||||
* \sa SDL_EnclosePoints
|
||||
* \sa SDL_PointInRect
|
||||
* \sa SDL_EnclosePoints
|
||||
* \sa SDL_PointInRect
|
||||
*/
|
||||
typedef struct SDL_FPoint
|
||||
{
|
||||
|
@ -65,14 +65,14 @@ typedef struct SDL_FPoint
|
|||
|
||||
|
||||
/**
|
||||
* \brief A rectangle, with the origin at the upper left (integer).
|
||||
* A rectangle, with the origin at the upper left (integer).
|
||||
*
|
||||
* \sa SDL_RectEmpty
|
||||
* \sa SDL_RectEquals
|
||||
* \sa SDL_HasIntersection
|
||||
* \sa SDL_IntersectRect
|
||||
* \sa SDL_UnionRect
|
||||
* \sa SDL_EnclosePoints
|
||||
* \sa SDL_RectEmpty
|
||||
* \sa SDL_RectEquals
|
||||
* \sa SDL_HasIntersection
|
||||
* \sa SDL_IntersectRect
|
||||
* \sa SDL_UnionRect
|
||||
* \sa SDL_EnclosePoints
|
||||
*/
|
||||
typedef struct SDL_Rect
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ typedef struct SDL_Rect
|
|||
|
||||
|
||||
/**
|
||||
* \brief A rectangle, with the origin at the upper left (floating point).
|
||||
* A rectangle, with the origin at the upper left (floating point).
|
||||
*/
|
||||
typedef struct SDL_FRect
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ typedef struct SDL_FRect
|
|||
|
||||
|
||||
/**
|
||||
* \brief Returns true if point resides inside a rectangle.
|
||||
* Returns true if point resides inside a rectangle.
|
||||
*/
|
||||
SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Returns true if the rectangle has no area.
|
||||
* Returns true if the rectangle has no area.
|
||||
*/
|
||||
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Returns true if the two rectangles are equal.
|
||||
* Returns true if the two rectangles are equal.
|
||||
*/
|
||||
SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
|
||||
{
|
||||
|
@ -120,33 +120,66 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Determine whether two rectangles intersect.
|
||||
* Determine whether two rectangles intersect.
|
||||
*
|
||||
* \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
||||
* If either pointer is NULL the function will return SDL_FALSE.
|
||||
*
|
||||
* \param A an SDL_Rect structure representing the first rectangle
|
||||
* \param B an SDL_Rect structure representing the second rectangle
|
||||
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_IntersectRect
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
|
||||
const SDL_Rect * B);
|
||||
|
||||
/**
|
||||
* \brief Calculate the intersection of two rectangles.
|
||||
* Calculate the intersection of two rectangles.
|
||||
*
|
||||
* \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
||||
* If `result` is NULL then this function will return SDL_FALSE.
|
||||
*
|
||||
* \param A an SDL_Rect structure representing the first rectangle
|
||||
* \param B an SDL_Rect structure representing the second rectangle
|
||||
* \param result an SDL_Rect structure filled in with the intersection of
|
||||
* rectangles `A` and `B`
|
||||
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_HasIntersection
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
|
||||
const SDL_Rect * B,
|
||||
SDL_Rect * result);
|
||||
|
||||
/**
|
||||
* \brief Calculate the union of two rectangles.
|
||||
* Calculate the union of two rectangles.
|
||||
*
|
||||
* \param A an SDL_Rect structure representing the first rectangle
|
||||
* \param B an SDL_Rect structure representing the second rectangle
|
||||
* \param result an SDL_Rect structure filled in with the union of rectangles
|
||||
* `A` and `B`
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
|
||||
const SDL_Rect * B,
|
||||
SDL_Rect * result);
|
||||
|
||||
/**
|
||||
* \brief Calculate a minimal rectangle enclosing a set of points
|
||||
* Calculate a minimal rectangle enclosing a set of points.
|
||||
*
|
||||
* \return SDL_TRUE if any points were within the clipping rect
|
||||
* If `clip` is not NULL then only points inside of the clipping rectangle are
|
||||
* considered.
|
||||
*
|
||||
* \param points an array of SDL_Point structures representing points to be
|
||||
* enclosed
|
||||
* \param count the number of structures in the `points` array
|
||||
* \param clip an SDL_Rect used for clipping or NULL to enclose all points
|
||||
* \param result an SDL_Rect structure filled in with the minimal enclosing
|
||||
* rectangle
|
||||
* \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the
|
||||
* points were outside of the clipping rectangle.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
|
||||
int count,
|
||||
|
@ -154,9 +187,20 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
|
|||
SDL_Rect * result);
|
||||
|
||||
/**
|
||||
* \brief Calculate the intersection of a rectangle and line segment.
|
||||
* Calculate the intersection of a rectangle and line segment.
|
||||
*
|
||||
* \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
||||
* This function is used to clip a line segment to a rectangle. A line segment
|
||||
* contained entirely within the rectangle or that does not intersect will
|
||||
* remain unchanged. A line segment that crosses the rectangle at either or
|
||||
* both ends will be clipped to the boundary of the rectangle and the new
|
||||
* coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.
|
||||
*
|
||||
* \param rect an SDL_Rect structure representing the rectangle to intersect
|
||||
* \param X1 a pointer to the starting X-coordinate of the line
|
||||
* \param Y1 a pointer to the starting Y-coordinate of the line
|
||||
* \param X2 a pointer to the ending X-coordinate of the line
|
||||
* \param Y2 a pointer to the ending Y-coordinate of the line
|
||||
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
|
||||
rect, int *X1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue