Skip to content

Commit

Permalink
SDL API renaming: SDL_rect.h
Browse files Browse the repository at this point in the history
Fixes #6887
  • Loading branch information
slouken committed Dec 27, 2022
1 parent a28d1d5 commit 58aecf0
Show file tree
Hide file tree
Showing 32 changed files with 379 additions and 323 deletions.
20 changes: 20 additions & 0 deletions docs/README-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,26 @@ The following functions have been renamed:

The preprocessor symbol __MACOSX__ has been renamed __MACOS__, and __IPHONEOS__ has been renamed __IOS__

## SDL_rect.h

The following functions have been renamed:
* SDL_EncloseFPoints => SDL_GetRectEnclosingPointsF
* SDL_EnclosePoints => SDL_GetRectEnclosingPoints
* SDL_FRectEmpty => SDL_IsRectEmptyF
* SDL_FRectEqualsEpsilon => SDL_AreRectsEqualF
* SDL_HasIntersection => SDL_HasRectIntersection
* SDL_HasIntersectionF => SDL_HasRectIntersectionF
* SDL_IntersectFRect => SDL_GetRectIntersectionF
* SDL_IntersectFRectAndLine => SDL_GetRectAndLineIntersectionF
* SDL_IntersectRect => SDL_GetRectIntersection
* SDL_IntersectRectAndLine => SDL_GetRectAndLineIntersection
* SDL_PointInFRect => SDL_IsPointInRectF
* SDL_PointInRect => SDL_IsPointInRect
* SDL_RectEmpty => SDL_IsRectEmpty
* SDL_RectEquals => SDL_AreRectsEqual
* SDL_UnionFRect => SDL_GetRectUnionF
* SDL_UnionRect => SDL_GetRectUnion

## SDL_render.h

SDL_GetRenderDriverInfo() has been removed, since most of the information it reported were
Expand Down
36 changes: 36 additions & 0 deletions include/SDL3/SDL_oldnames.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,24 @@
#define __MACOSX__ __MACOS__
#endif

/* ##SDL_rect.h */
#define SDL_EncloseFPoints SDL_GetRectEnclosingPointsF
#define SDL_EnclosePoints SDL_GetRectEnclosingPoints
#define SDL_FRectEmpty SDL_IsRectEmptyF
#define SDL_FRectEqualsEpsilon SDL_AreRectsEqualF
#define SDL_HasIntersection SDL_HasRectIntersection
#define SDL_HasIntersectionF SDL_HasRectIntersectionF
#define SDL_IntersectFRect SDL_GetRectIntersectionF
#define SDL_IntersectFRectAndLine SDL_GetRectAndLineIntersectionF
#define SDL_IntersectRect SDL_GetRectIntersection
#define SDL_IntersectRectAndLine SDL_GetRectAndLineIntersection
#define SDL_PointInFRect SDL_IsPointInRectF
#define SDL_PointInRect SDL_IsPointInRect
#define SDL_RectEmpty SDL_IsRectEmpty
#define SDL_RectEquals SDL_AreRectsEqual
#define SDL_UnionFRect SDL_GetRectUnionF
#define SDL_UnionRect SDL_GetRectUnion

/* ##SDL_render.h */
#define SDL_RenderCopy SDL_RenderTexture
#define SDL_RenderCopyEx SDL_RenderTextureRotated
Expand Down Expand Up @@ -575,6 +593,24 @@
#define __MACOSX__ __MACOSX___renamed___MACOS__
#endif

/* ##SDL_rect.h */
#define SDL_EncloseFPoints SDL_EncloseFPoints_renamed_SDL_GetRectEnclosingPointsF
#define SDL_EnclosePoints SDL_EnclosePoints_renamed_SDL_GetRectEnclosingPoints
#define SDL_FRectEmpty SDL_FRectEmpty_renamed_SDL_IsRectEmptyF
#define SDL_FRectEqualsEpsilon SDL_FRectEqualsEpsilon_renamed_SDL_AreRectsEqualF
#define SDL_HasIntersection SDL_HasIntersection_renamed_SDL_HasRectIntersection
#define SDL_HasIntersectionF SDL_HasIntersectionF_renamed_SDL_HasRectIntersectionF
#define SDL_IntersectFRect SDL_IntersectFRect_renamed_SDL_GetRectIntersectionF
#define SDL_IntersectFRectAndLine SDL_IntersectFRectAndLine_renamed_SDL_GetRectAndLineIntersectionF
#define SDL_IntersectRect SDL_IntersectRect_renamed_SDL_GetRectIntersection
#define SDL_IntersectRectAndLine SDL_IntersectRectAndLine_renamed_SDL_GetRectAndLineIntersection
#define SDL_PointInFRect SDL_PointInFRect_renamed_SDL_IsPointInRectF
#define SDL_PointInRect SDL_PointInRect_renamed_SDL_IsPointInRect
#define SDL_RectEmpty SDL_RectEmpty_renamed_SDL_IsRectEmpty
#define SDL_RectEquals SDL_RectEquals_renamed_SDL_AreRectsEqual
#define SDL_UnionFRect SDL_UnionFRect_renamed_SDL_GetRectUnionF
#define SDL_UnionRect SDL_UnionRect_renamed_SDL_GetRectUnion

/* ##SDL_render.h */
#define SDL_RenderCopy SDL_RenderCopy_renamed_SDL_RenderTexture
#define SDL_RenderCopyEx SDL_RenderCopyEx_renamed_SDL_RenderTextureRotated
Expand Down
80 changes: 40 additions & 40 deletions include/SDL3/SDL_rect.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ extern "C" {
/**
* The structure that defines a point (integer)
*
* \sa SDL_EnclosePoints
* \sa SDL_PointInRect
* \sa SDL_GetRectEnclosingPoints
* \sa SDL_IsPointInRect
*/
typedef struct SDL_Point
{
Expand All @@ -54,8 +54,8 @@ typedef struct SDL_Point
/**
* The structure that defines a point (floating point)
*
* \sa SDL_EncloseFPoints
* \sa SDL_PointInFRect
* \sa SDL_GetRectEnclosingPointsF
* \sa SDL_IsPointInRectF
*/
typedef struct SDL_FPoint
{
Expand All @@ -67,13 +67,13 @@ typedef struct SDL_FPoint
/**
* A rectangle, with the origin at the upper left (integer).
*
* \sa SDL_RectEmpty
* \sa SDL_RectEquals
* \sa SDL_HasIntersection
* \sa SDL_IntersectRect
* \sa SDL_IntersectRectAndLine
* \sa SDL_UnionRect
* \sa SDL_EnclosePoints
* \sa SDL_IsRectEmpty
* \sa SDL_AreRectsEqual
* \sa SDL_HasRectIntersection
* \sa SDL_GetRectIntersection
* \sa SDL_GetRectAndLineIntersection
* \sa SDL_GetRectUnion
* \sa SDL_GetRectEnclosingPoints
*/
typedef struct SDL_Rect
{
Expand All @@ -85,15 +85,15 @@ typedef struct SDL_Rect
/**
* A rectangle, with the origin at the upper left (floating point).
*
* \sa SDL_FRectEmpty
* \sa SDL_IsRectEmptyF
* \sa SDL_FRectEquals
* \sa SDL_FRectEqualsEpsilon
* \sa SDL_HasIntersectionF
* \sa SDL_IntersectFRect
* \sa SDL_IntersectFRectAndLine
* \sa SDL_UnionFRect
* \sa SDL_EncloseFPoints
* \sa SDL_PointInFRect
* \sa SDL_AreRectsEqualF
* \sa SDL_HasRectIntersectionF
* \sa SDL_GetRectIntersectionF
* \sa SDL_GetRectAndLineIntersectionF
* \sa SDL_GetRectUnionF
* \sa SDL_GetRectEnclosingPointsF
* \sa SDL_IsPointInRectF
*/
typedef struct SDL_FRect
{
Expand All @@ -107,7 +107,7 @@ typedef struct SDL_FRect
/**
* Returns true if point resides inside a rectangle.
*/
SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
SDL_FORCE_INLINE SDL_bool SDL_IsPointInRect(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;
Expand All @@ -116,15 +116,15 @@ SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
/**
* Returns true if the rectangle has no area.
*/
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
SDL_FORCE_INLINE SDL_bool SDL_IsRectEmpty(const SDL_Rect *r)
{
return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE;
}

/**
* Returns true if the two rectangles are equal.
*/
SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
SDL_FORCE_INLINE SDL_bool SDL_AreRectsEqual(const SDL_Rect *a, const SDL_Rect *b)
{
return (a && b && (a->x == b->x) && (a->y == b->y) &&
(a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE;
Expand All @@ -141,9 +141,9 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_IntersectRect
* \sa SDL_GetRectIntersection
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
extern DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersection(const SDL_Rect * A,
const SDL_Rect * B);

/**
Expand All @@ -159,9 +159,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_HasIntersection
* \sa SDL_HasRectIntersection
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
extern DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect * A,
const SDL_Rect * B,
SDL_Rect * result);

Expand All @@ -175,7 +175,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
extern DECLSPEC void SDLCALL SDL_GetRectUnion(const SDL_Rect * A,
const SDL_Rect * B,
SDL_Rect * result);

Expand All @@ -196,7 +196,7 @@ extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
extern DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point * points,
int count,
const SDL_Rect * clip,
SDL_Rect * result);
Expand All @@ -219,7 +219,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
extern DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Rect *
rect, int *X1,
int *Y1, int *X2,
int *Y2);
Expand All @@ -230,7 +230,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
/**
* Returns true if point resides inside a rectangle.
*/
SDL_FORCE_INLINE SDL_bool SDL_PointInFRect(const SDL_FPoint *p, const SDL_FRect *r)
SDL_FORCE_INLINE SDL_bool SDL_IsPointInRectF(const SDL_FPoint *p, const SDL_FRect *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;
Expand All @@ -239,7 +239,7 @@ SDL_FORCE_INLINE SDL_bool SDL_PointInFRect(const SDL_FPoint *p, const SDL_FRect
/**
* Returns true if the rectangle has no area.
*/
SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r)
SDL_FORCE_INLINE SDL_bool SDL_IsRectEmptyF(const SDL_FRect *r)
{
return ((!r) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? SDL_TRUE : SDL_FALSE;
}
Expand All @@ -249,7 +249,7 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r)
*
* \since This function is available since SDL 2.0.22.
*/
SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon)
SDL_FORCE_INLINE SDL_bool SDL_AreRectsEqualF(const SDL_FRect *a, const SDL_FRect *b, const float epsilon)
{
return (a && b && ((a == b) ||
((SDL_fabsf(a->x - b->x) <= epsilon) &&
Expand All @@ -266,7 +266,7 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_F
*/
SDL_FORCE_INLINE SDL_bool SDL_FRectEquals(const SDL_FRect *a, const SDL_FRect *b)
{
return SDL_FRectEqualsEpsilon(a, b, SDL_FLT_EPSILON);
return SDL_AreRectsEqualF(a, b, SDL_FLT_EPSILON);
}

/**
Expand All @@ -280,9 +280,9 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEquals(const SDL_FRect *a, const SDL_FRect *b
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_IntersectRect
* \sa SDL_GetRectIntersection
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersectionF(const SDL_FRect * A,
extern DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersectionF(const SDL_FRect * A,
const SDL_FRect * B);

/**
Expand All @@ -298,9 +298,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersectionF(const SDL_FRect * A,
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_HasIntersectionF
* \sa SDL_HasRectIntersectionF
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRect(const SDL_FRect * A,
extern DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionF(const SDL_FRect * A,
const SDL_FRect * B,
SDL_FRect * result);

Expand All @@ -314,7 +314,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRect(const SDL_FRect * A,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A,
extern DECLSPEC void SDLCALL SDL_GetRectUnionF(const SDL_FRect * A,
const SDL_FRect * B,
SDL_FRect * result);

Expand All @@ -336,7 +336,7 @@ extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points,
extern DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPointsF(const SDL_FPoint * points,
int count,
const SDL_FRect * clip,
SDL_FRect * result);
Expand All @@ -360,7 +360,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRectAndLine(const SDL_FRect *
extern DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersectionF(const SDL_FRect *
rect, float *X1,
float *Y1, float *X2,
float *Y2);
Expand Down
20 changes: 10 additions & 10 deletions src/dynapi/SDL_dynapi.sym
Original file line number Diff line number Diff line change
Expand Up @@ -395,16 +395,16 @@ SDL3_0.0.0 {
SDL_SetYUVConversionMode;
SDL_GetYUVConversionMode;
SDL_GetYUVConversionModeForResolution;
SDL_HasIntersection;
SDL_IntersectRect;
SDL_UnionRect;
SDL_EnclosePoints;
SDL_IntersectRectAndLine;
SDL_HasIntersectionF;
SDL_IntersectFRect;
SDL_UnionFRect;
SDL_EncloseFPoints;
SDL_IntersectFRectAndLine;
SDL_HasRectIntersection;
SDL_GetRectIntersection;
SDL_GetRectUnion;
SDL_GetRectEnclosingPoints;
SDL_GetRectAndLineIntersection;
SDL_HasRectIntersectionF;
SDL_GetRectIntersectionF;
SDL_GetRectUnionF;
SDL_GetRectEnclosingPointsF;
SDL_GetRectAndLineIntersectionF;
SDL_CreateShapedWindow;
SDL_IsShapedWindow;
SDL_SetWindowShape;
Expand Down
20 changes: 10 additions & 10 deletions src/dynapi/SDL_dynapi_overrides.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@
#define SDL_GetRGBA SDL_GetRGBA_REAL
#define SDL_GetPlatform SDL_GetPlatform_REAL
#define SDL_GetPowerInfo SDL_GetPowerInfo_REAL
#define SDL_HasIntersection SDL_HasIntersection_REAL
#define SDL_IntersectRect SDL_IntersectRect_REAL
#define SDL_UnionRect SDL_UnionRect_REAL
#define SDL_EnclosePoints SDL_EnclosePoints_REAL
#define SDL_IntersectRectAndLine SDL_IntersectRectAndLine_REAL
#define SDL_HasRectIntersection SDL_HasRectIntersection_REAL
#define SDL_GetRectIntersection SDL_GetRectIntersection_REAL
#define SDL_GetRectUnion SDL_GetRectUnion_REAL
#define SDL_GetRectEnclosingPoints SDL_GetRectEnclosingPoints_REAL
#define SDL_GetRectAndLineIntersection SDL_GetRectAndLineIntersection_REAL
#define SDL_GetNumRenderDrivers SDL_GetNumRenderDrivers_REAL
#define SDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer_REAL
#define SDL_CreateRenderer SDL_CreateRenderer_REAL
Expand Down Expand Up @@ -828,11 +828,11 @@
#define SDL_GetTouchName SDL_GetTouchName_REAL
#define SDL_ClearComposition SDL_ClearComposition_REAL
#define SDL_IsTextInputShown SDL_IsTextInputShown_REAL
#define SDL_HasIntersectionF SDL_HasIntersectionF_REAL
#define SDL_IntersectFRect SDL_IntersectFRect_REAL
#define SDL_UnionFRect SDL_UnionFRect_REAL
#define SDL_EncloseFPoints SDL_EncloseFPoints_REAL
#define SDL_IntersectFRectAndLine SDL_IntersectFRectAndLine_REAL
#define SDL_HasRectIntersectionF SDL_HasRectIntersectionF_REAL
#define SDL_GetRectIntersectionF SDL_GetRectIntersectionF_REAL
#define SDL_GetRectUnionF SDL_GetRectUnionF_REAL
#define SDL_GetRectEnclosingPointsF SDL_GetRectEnclosingPointsF_REAL
#define SDL_GetRectAndLineIntersectionF SDL_GetRectAndLineIntersectionF_REAL
#define SDL_GetRenderWindow SDL_GetRenderWindow_REAL
#define SDL_bsearch SDL_bsearch_REAL
#define SDL_GetGamepadPathForIndex SDL_GetGamepadPathForIndex_REAL
Expand Down
Loading

0 comments on commit 58aecf0

Please sign in to comment.