Removed non-float versions of SDL render API drawing functions

This simplifies the API and removes a level of API translation between the int variants of the functions and the float implementation

Fixes https://github.com/libsdl-org/SDL/issues/6656
This commit is contained in:
Sam Lantinga 2022-12-31 11:19:32 -08:00
parent bf76fc6b05
commit 9c1a9ecb4b
29 changed files with 465 additions and 1119 deletions

View file

@ -472,24 +472,16 @@ to decide for you.
SDL_RenderWindowToLogical() and SDL_RenderLogicalToWindow() take floating point coordinates in both directions.
The following functions have been renamed:
* SDL_RenderCopy() => SDL_RenderTexture()
* SDL_RenderCopyEx() => SDL_RenderTextureRotated()
* SDL_RenderCopyExF() => SDL_RenderTextureRotatedFloat()
* SDL_RenderCopyF() => SDL_RenderTextureFloat()
* SDL_RenderDrawLine() => SDL_RenderLine()
* SDL_RenderDrawLineF() => SDL_RenderLineFloat()
* SDL_RenderDrawLines() => SDL_RenderLines()
* SDL_RenderDrawLinesF() => SDL_RenderLinesFloat()
* SDL_RenderDrawPoint() => SDL_RenderPoint()
* SDL_RenderDrawPointF() => SDL_RenderPointFloat()
* SDL_RenderDrawPoints() => SDL_RenderPoints()
* SDL_RenderDrawPointsF() => SDL_RenderPointsFloat()
* SDL_RenderDrawRect() => SDL_RenderRect()
* SDL_RenderDrawRectF() => SDL_RenderRectFloat()
* SDL_RenderDrawRects() => SDL_RenderRects()
* SDL_RenderDrawRectsF() => SDL_RenderRectsFloat()
* SDL_RenderFillRectF() => SDL_RenderFillRectFloat()
* SDL_RenderFillRectsF() => SDL_RenderFillRectsFloat()
* SDL_RenderCopyExF() => SDL_RenderTextureRotated()
* SDL_RenderCopyF() => SDL_RenderTexture()
* SDL_RenderDrawLineF() => SDL_RenderLine()
* SDL_RenderDrawLinesF() => SDL_RenderLines()
* SDL_RenderDrawPointF() => SDL_RenderPoint()
* SDL_RenderDrawPointsF() => SDL_RenderPoints()
* SDL_RenderDrawRectF() => SDL_RenderRect()
* SDL_RenderDrawRectsF() => SDL_RenderRects()
* SDL_RenderFillRectF() => SDL_RenderFillRect()
* SDL_RenderFillRectsF() => SDL_RenderFillRects()
* SDL_RenderGetClipRect() => SDL_GetRenderClipRect()
* SDL_RenderGetIntegerScale() => SDL_GetRenderIntegerScale()
* SDL_RenderGetLogicalSize() => SDL_GetRenderLogicalSize()
@ -506,6 +498,18 @@ The following functions have been renamed:
* SDL_RenderSetVSync() => SDL_SetRenderVSync()
* SDL_RenderSetViewport() => SDL_SetRenderViewport()
The following functions have been removed:
* SDL_RenderCopy()
* SDL_RenderCopyEx()
* SDL_RenderDrawLine()
* SDL_RenderDrawLines()
* SDL_RenderDrawPoint()
* SDL_RenderDrawPoints()
* SDL_RenderDrawRect()
* SDL_RenderDrawRects()
* SDL_RenderFillRect()
* SDL_RenderFillRects()
## SDL_rwops.h
The following symbols have been renamed:

View file

@ -276,24 +276,16 @@
#define SDL_UnionRect SDL_GetRectUnion
/* ##SDL_render.h */
#define SDL_RenderCopy SDL_RenderTexture
#define SDL_RenderCopyEx SDL_RenderTextureRotated
#define SDL_RenderCopyExF SDL_RenderTextureRotatedFloat
#define SDL_RenderCopyF SDL_RenderTextureFloat
#define SDL_RenderDrawLine SDL_RenderLine
#define SDL_RenderDrawLineF SDL_RenderLineFloat
#define SDL_RenderDrawLines SDL_RenderLines
#define SDL_RenderDrawLinesF SDL_RenderLinesFloat
#define SDL_RenderDrawPoint SDL_RenderPoint
#define SDL_RenderDrawPointF SDL_RenderPointFloat
#define SDL_RenderDrawPoints SDL_RenderPoints
#define SDL_RenderDrawPointsF SDL_RenderPointsFloat
#define SDL_RenderDrawRect SDL_RenderRect
#define SDL_RenderDrawRectF SDL_RenderRectFloat
#define SDL_RenderDrawRects SDL_RenderRects
#define SDL_RenderDrawRectsF SDL_RenderRectsFloat
#define SDL_RenderFillRectF SDL_RenderFillRectFloat
#define SDL_RenderFillRectsF SDL_RenderFillRectsFloat
#define SDL_RenderCopyExF SDL_RenderTextureRotated
#define SDL_RenderCopyF SDL_RenderTexture
#define SDL_RenderDrawLineF SDL_RenderLine
#define SDL_RenderDrawLinesF SDL_RenderLines
#define SDL_RenderDrawPointF SDL_RenderPoint
#define SDL_RenderDrawPointsF SDL_RenderPoints
#define SDL_RenderDrawRectF SDL_RenderRect
#define SDL_RenderDrawRectsF SDL_RenderRects
#define SDL_RenderFillRectF SDL_RenderFillRect
#define SDL_RenderFillRectsF SDL_RenderFillRects
#define SDL_RenderGetClipRect SDL_GetRenderClipRect
#define SDL_RenderGetIntegerScale SDL_GetRenderIntegerScale
#define SDL_RenderGetLogicalSize SDL_GetRenderLogicalSize
@ -607,24 +599,16 @@
#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
#define SDL_RenderCopyExF SDL_RenderCopyExF_renamed_SDL_RenderTextureRotatedFloat
#define SDL_RenderCopyF SDL_RenderCopyF_renamed_SDL_RenderTextureFloat
#define SDL_RenderDrawLine SDL_RenderDrawLine_renamed_SDL_RenderLine
#define SDL_RenderDrawLineF SDL_RenderDrawLineF_renamed_SDL_RenderLineFloat
#define SDL_RenderDrawLines SDL_RenderDrawLines_renamed_SDL_RenderLines
#define SDL_RenderDrawLinesF SDL_RenderDrawLinesF_renamed_SDL_RenderLinesFloat
#define SDL_RenderDrawPoint SDL_RenderDrawPoint_renamed_SDL_RenderPoint
#define SDL_RenderDrawPointF SDL_RenderDrawPointF_renamed_SDL_RenderPointFloat
#define SDL_RenderDrawPoints SDL_RenderDrawPoints_renamed_SDL_RenderPoints
#define SDL_RenderDrawPointsF SDL_RenderDrawPointsF_renamed_SDL_RenderPointsFloat
#define SDL_RenderDrawRect SDL_RenderDrawRect_renamed_SDL_RenderRect
#define SDL_RenderDrawRectF SDL_RenderDrawRectF_renamed_SDL_RenderRectFloat
#define SDL_RenderDrawRects SDL_RenderDrawRects_renamed_SDL_RenderRects
#define SDL_RenderDrawRectsF SDL_RenderDrawRectsF_renamed_SDL_RenderRectsFloat
#define SDL_RenderFillRectF SDL_RenderFillRectF_renamed_SDL_RenderFillRectFloat
#define SDL_RenderFillRectsF SDL_RenderFillRectsF_renamed_SDL_RenderFillRectsFloat
#define SDL_RenderCopyExF SDL_RenderCopyExF_renamed_SDL_RenderTextureRotated
#define SDL_RenderCopyF SDL_RenderCopyF_renamed_SDL_RenderTexture
#define SDL_RenderDrawLineF SDL_RenderDrawLineF_renamed_SDL_RenderLine
#define SDL_RenderDrawLinesF SDL_RenderDrawLinesF_renamed_SDL_RenderLines
#define SDL_RenderDrawPointF SDL_RenderDrawPointF_renamed_SDL_RenderPoint
#define SDL_RenderDrawPointsF SDL_RenderDrawPointsF_renamed_SDL_RenderPoints
#define SDL_RenderDrawRectF SDL_RenderDrawRectF_renamed_SDL_RenderRect
#define SDL_RenderDrawRectsF SDL_RenderDrawRectsF_renamed_SDL_RenderRects
#define SDL_RenderFillRectF SDL_RenderFillRectF_renamed_SDL_RenderFillRect
#define SDL_RenderFillRectsF SDL_RenderFillRectsF_renamed_SDL_RenderFillRects
#define SDL_RenderGetClipRect SDL_RenderGetClipRect_renamed_SDL_GetRenderClipRect
#define SDL_RenderGetIntegerScale SDL_RenderGetIntegerScale_renamed_SDL_GetRenderIntegerScale
#define SDL_RenderGetLogicalSize SDL_RenderGetLogicalSize_renamed_SDL_GetRenderLogicalSize

View file

@ -211,9 +211,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetRenderDriver(int index);
* \sa SDL_CreateRenderer
* \sa SDL_CreateWindow
*/
extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
int width, int height, Uint32 window_flags,
SDL_Window **window, SDL_Renderer **renderer);
extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer);
/**
@ -241,8 +239,7 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
* \sa SDL_GetRenderDriver
* \sa SDL_GetRendererInfo
*/
extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
const char *name, Uint32 flags);
extern DECLSPEC SDL_Renderer *SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags);
/**
* Create a 2D software rendering context for a surface.
@ -302,8 +299,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer)
*
* \sa SDL_CreateRenderer
*/
extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
SDL_RendererInfo * info);
extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info);
/**
* Get the output size in pixels of a rendering context.
@ -322,8 +318,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
*
* \sa SDL_GetRenderer
*/
extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
int *w, int *h);
extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer *renderer, int *w, int *h);
/**
* Create a texture for a rendering context.
@ -347,10 +342,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
* \sa SDL_QueryTexture
* \sa SDL_UpdateTexture
*/
extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
Uint32 format,
int access, int w,
int h);
extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h);
/**
* Create a texture from an existing surface.
@ -400,9 +392,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer
*
* \sa SDL_CreateTexture
*/
extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
Uint32 * format, int *access,
int *w, int *h);
extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h);
/**
* Set an additional color value multiplied into render copy operations.
@ -428,8 +418,7 @@ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
* \sa SDL_GetTextureColorMod
* \sa SDL_SetTextureAlphaMod
*/
extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
Uint8 r, Uint8 g, Uint8 b);
extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b);
/**
@ -447,9 +436,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
* \sa SDL_GetTextureAlphaMod
* \sa SDL_SetTextureColorMod
*/
extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
Uint8 * r, Uint8 * g,
Uint8 * b);
extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b);
/**
* Set an additional alpha value multiplied into render copy operations.
@ -472,8 +459,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
* \sa SDL_GetTextureAlphaMod
* \sa SDL_SetTextureColorMod
*/
extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
Uint8 alpha);
extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha);
/**
* Get the additional alpha value multiplied into render copy operations.
@ -488,8 +474,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
* \sa SDL_GetTextureColorMod
* \sa SDL_SetTextureAlphaMod
*/
extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
Uint8 * alpha);
extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha);
/**
* Set the blend mode for a texture, used by SDL_RenderTexture().
@ -507,8 +492,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
* \sa SDL_GetTextureBlendMode
* \sa SDL_RenderTexture
*/
extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
SDL_BlendMode blendMode);
extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode);
/**
* Get the blend mode used for texture copy operations.
@ -522,8 +506,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
*
* \sa SDL_SetTextureBlendMode
*/
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
SDL_BlendMode *blendMode);
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode);
/**
* Set the scale mode used for texture scale operations.
@ -538,8 +521,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
*
* \sa SDL_GetTextureScaleMode
*/
extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
SDL_ScaleMode scaleMode);
extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode);
/**
* Get the scale mode used for texture scale operations.
@ -552,8 +534,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
*
* \sa SDL_SetTextureScaleMode
*/
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
SDL_ScaleMode *scaleMode);
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
/**
* Associate a user-specified pointer with a texture.
@ -566,8 +547,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
*
* \sa SDL_GetTextureUserData
*/
extern DECLSPEC int SDLCALL SDL_SetTextureUserData(SDL_Texture * texture,
void *userdata);
extern DECLSPEC int SDLCALL SDL_SetTextureUserData(SDL_Texture *texture, void *userdata);
/**
* Get the user-specified pointer associated with a texture
@ -611,9 +591,7 @@ extern DECLSPEC void * SDLCALL SDL_GetTextureUserData(SDL_Texture * texture);
* \sa SDL_LockTexture
* \sa SDL_UnlockTexture
*/
extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
const SDL_Rect * rect,
const void *pixels, int pitch);
extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch);
/**
* Update a rectangle within a planar YV12 or IYUV texture with new pixel
@ -793,8 +771,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *rendere
*
* \sa SDL_GetRenderTarget
*/
extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer,
SDL_Texture *texture);
extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture);
/**
* Get the current render target.
@ -877,8 +854,7 @@ extern DECLSPEC void SDLCALL SDL_GetRenderLogicalSize(SDL_Renderer * renderer, i
* \sa SDL_GetRenderIntegerScale
* \sa SDL_SetRenderLogicalSize
*/
extern DECLSPEC int SDLCALL SDL_SetRenderIntegerScale(SDL_Renderer * renderer,
SDL_bool enable);
extern DECLSPEC int SDLCALL SDL_SetRenderIntegerScale(SDL_Renderer *renderer, SDL_bool enable);
/**
* Get whether integer scales are forced for resolution-independent rendering.
@ -909,8 +885,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRenderIntegerScale(SDL_Renderer * render
*
* \sa SDL_GetRenderViewport
*/
extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer * renderer,
const SDL_Rect * rect);
extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
/**
* Get the drawing area for the current target.
@ -922,8 +897,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer * renderer,
*
* \sa SDL_SetRenderViewport
*/
extern DECLSPEC void SDLCALL SDL_GetRenderViewport(SDL_Renderer * renderer,
SDL_Rect * rect);
extern DECLSPEC void SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
/**
* Set the clip rectangle for rendering on the specified target.
@ -940,8 +914,7 @@ extern DECLSPEC void SDLCALL SDL_GetRenderViewport(SDL_Renderer * renderer,
* \sa SDL_GetRenderClipRect
* \sa SDL_RenderClipEnabled
*/
extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer * renderer,
const SDL_Rect * rect);
extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
/**
* Get the clip rectangle for the current target.
@ -956,8 +929,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer * renderer,
* \sa SDL_RenderClipEnabled
* \sa SDL_SetRenderClipRect
*/
extern DECLSPEC void SDLCALL SDL_GetRenderClipRect(SDL_Renderer * renderer,
SDL_Rect * rect);
extern DECLSPEC void SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
/**
* Get whether clipping is enabled on the given renderer.
@ -996,8 +968,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer * renderer);
* \sa SDL_GetRenderScale
* \sa SDL_SetRenderLogicalSize
*/
extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer * renderer,
float scaleX, float scaleY);
extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
/**
* Get the drawing scale for the current target.
@ -1010,8 +981,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer * renderer,
*
* \sa SDL_SetRenderScale
*/
extern DECLSPEC void SDLCALL SDL_GetRenderScale(SDL_Renderer * renderer,
float *scaleX, float *scaleY);
extern DECLSPEC void SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
/**
* Get logical coordinates of point in renderer when given real coordinates of
@ -1093,9 +1063,7 @@ extern DECLSPEC void SDLCALL SDL_RenderLogicalToWindow(SDL_Renderer *renderer,
* \sa SDL_RenderFillRect
* \sa SDL_RenderFillRects
*/
extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer,
Uint8 r, Uint8 g, Uint8 b,
Uint8 a);
extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/**
* Get the color used for drawing operations (Rect, Line and Clear).
@ -1116,9 +1084,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer,
*
* \sa SDL_SetRenderDrawColor
*/
extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer,
Uint8 * r, Uint8 * g, Uint8 * b,
Uint8 * a);
extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
/**
* Set the blend mode used for drawing operations (Fill and Line).
@ -1142,8 +1108,7 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer,
* \sa SDL_RenderFillRect
* \sa SDL_RenderFillRects
*/
extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
SDL_BlendMode blendMode);
extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
/**
* Get the blend mode used for drawing operations.
@ -1157,8 +1122,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
*
* \sa SDL_SetRenderDrawBlendMode
*/
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
SDL_BlendMode *blendMode);
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
/**
* Clear the current rendering target with the drawing color.
@ -1176,306 +1140,6 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
*/
extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
/**
* Draw a point on the current rendering target.
*
* SDL_RenderPoint() draws a single point. If you want to draw multiple,
* use SDL_RenderPoints() instead.
*
* \param renderer the rendering context
* \param x the x coordinate of the point
* \param y the y coordinate of the point
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderLine
* \sa SDL_RenderLines
* \sa SDL_RenderPoints
* \sa SDL_RenderRect
* \sa SDL_RenderRects
* \sa SDL_RenderFillRect
* \sa SDL_RenderFillRects
* \sa SDL_RenderPresent
* \sa SDL_SetRenderDrawBlendMode
* \sa SDL_SetRenderDrawColor
*/
extern DECLSPEC int SDLCALL SDL_RenderPoint(SDL_Renderer * renderer,
int x, int y);
/**
* Draw multiple points on the current rendering target.
*
* \param renderer the rendering context
* \param points an array of SDL_Point structures that represent the points to
* draw
* \param count the number of points to draw
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderLine
* \sa SDL_RenderLines
* \sa SDL_RenderPoint
* \sa SDL_RenderRect
* \sa SDL_RenderRects
* \sa SDL_RenderFillRect
* \sa SDL_RenderFillRects
* \sa SDL_RenderPresent
* \sa SDL_SetRenderDrawBlendMode
* \sa SDL_SetRenderDrawColor
*/
extern DECLSPEC int SDLCALL SDL_RenderPoints(SDL_Renderer * renderer,
const SDL_Point * points,
int count);
/**
* Draw a line on the current rendering target.
*
* SDL_RenderLine() draws the line to include both end points. If you want
* to draw multiple, connecting lines use SDL_RenderLines() instead.
*
* \param renderer the rendering context
* \param x1 the x coordinate of the start point
* \param y1 the y coordinate of the start point
* \param x2 the x coordinate of the end point
* \param y2 the y coordinate of the end point
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderLines
* \sa SDL_RenderPoint
* \sa SDL_RenderPoints
* \sa SDL_RenderRect
* \sa SDL_RenderRects
* \sa SDL_RenderFillRect
* \sa SDL_RenderFillRects
* \sa SDL_RenderPresent
* \sa SDL_SetRenderDrawBlendMode
* \sa SDL_SetRenderDrawColor
*/
extern DECLSPEC int SDLCALL SDL_RenderLine(SDL_Renderer * renderer,
int x1, int y1, int x2, int y2);
/**
* Draw a series of connected lines on the current rendering target.
*
* \param renderer the rendering context
* \param points an array of SDL_Point structures representing points along
* the lines
* \param count the number of points, drawing count-1 lines
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderLine
* \sa SDL_RenderPoint
* \sa SDL_RenderPoints
* \sa SDL_RenderRect
* \sa SDL_RenderRects
* \sa SDL_RenderFillRect
* \sa SDL_RenderFillRects
* \sa SDL_RenderPresent
* \sa SDL_SetRenderDrawBlendMode
* \sa SDL_SetRenderDrawColor
*/
extern DECLSPEC int SDLCALL SDL_RenderLines(SDL_Renderer * renderer,
const SDL_Point * points,
int count);
/**
* Draw a rectangle on the current rendering target.
*
* \param renderer the rendering context
* \param rect an SDL_Rect structure representing the rectangle to draw, or
* NULL to outline the entire rendering target
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderLine
* \sa SDL_RenderLines
* \sa SDL_RenderPoint
* \sa SDL_RenderPoints
* \sa SDL_RenderRects
* \sa SDL_RenderFillRect
* \sa SDL_RenderFillRects
* \sa SDL_RenderPresent
* \sa SDL_SetRenderDrawBlendMode
* \sa SDL_SetRenderDrawColor
*/
extern DECLSPEC int SDLCALL SDL_RenderRect(SDL_Renderer * renderer,
const SDL_Rect * rect);
/**
* Draw some number of rectangles on the current rendering target.
*
* \param renderer the rendering context
* \param rects an array of SDL_Rect structures representing the rectangles to
* be drawn
* \param count the number of rectangles
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderLine
* \sa SDL_RenderLines
* \sa SDL_RenderPoint
* \sa SDL_RenderPoints
* \sa SDL_RenderRect
* \sa SDL_RenderFillRect
* \sa SDL_RenderFillRects
* \sa SDL_RenderPresent
* \sa SDL_SetRenderDrawBlendMode
* \sa SDL_SetRenderDrawColor
*/
extern DECLSPEC int SDLCALL SDL_RenderRects(SDL_Renderer * renderer,
const SDL_Rect * rects,
int count);
/**
* Fill a rectangle on the current rendering target with the drawing color.
*
* The current drawing color is set by SDL_SetRenderDrawColor(), and the
* color's alpha value is ignored unless blending is enabled with the
* appropriate call to SDL_SetRenderDrawBlendMode().
*
* \param renderer the rendering context
* \param rect the SDL_Rect structure representing the rectangle to fill, or
* NULL for the entire rendering target
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderLine
* \sa SDL_RenderLines
* \sa SDL_RenderPoint
* \sa SDL_RenderPoints
* \sa SDL_RenderRect
* \sa SDL_RenderRects
* \sa SDL_RenderFillRects
* \sa SDL_RenderPresent
* \sa SDL_SetRenderDrawBlendMode
* \sa SDL_SetRenderDrawColor
*/
extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
const SDL_Rect * rect);
/**
* Fill some number of rectangles on the current rendering target with the
* drawing color.
*
* \param renderer the rendering context
* \param rects an array of SDL_Rect structures representing the rectangles to
* be filled
* \param count the number of rectangles
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderLine
* \sa SDL_RenderLines
* \sa SDL_RenderPoint
* \sa SDL_RenderPoints
* \sa SDL_RenderRect
* \sa SDL_RenderRects
* \sa SDL_RenderFillRect
* \sa SDL_RenderPresent
*/
extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
const SDL_Rect * rects,
int count);
/**
* Copy a portion of the texture to the current rendering target.
*
* The texture is blended with the destination based on its blend mode set
* with SDL_SetTextureBlendMode().
*
* The texture color is affected based on its color modulation set by
* SDL_SetTextureColorMod().
*
* The texture alpha is affected based on its alpha modulation set by
* SDL_SetTextureAlphaMod().
*
* \param renderer the rendering context
* \param texture the source texture
* \param srcrect the source SDL_Rect structure or NULL for the entire texture
* \param dstrect the destination SDL_Rect structure or NULL for the entire
* rendering target; the texture will be stretched to fill the
* given rectangle
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderTextureRotated
* \sa SDL_SetTextureAlphaMod
* \sa SDL_SetTextureBlendMode
* \sa SDL_SetTextureColorMod
*/
extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer * renderer,
SDL_Texture * texture,
const SDL_Rect * srcrect,
const SDL_Rect * dstrect);
/**
* Copy a portion of the texture to the current rendering, with optional
* rotation and flipping.
*
* Copy a portion of the texture to the current rendering target, optionally
* rotating it by angle around the given center and also flipping it
* top-bottom and/or left-right.
*
* The texture is blended with the destination based on its blend mode set
* with SDL_SetTextureBlendMode().
*
* The texture color is affected based on its color modulation set by
* SDL_SetTextureColorMod().
*
* The texture alpha is affected based on its alpha modulation set by
* SDL_SetTextureAlphaMod().
*
* \param renderer the rendering context
* \param texture the source texture
* \param srcrect the source SDL_Rect structure or NULL for the entire texture
* \param dstrect the destination SDL_Rect structure or NULL for the entire
* rendering target
* \param angle an angle in degrees that indicates the rotation that will be
* applied to dstrect, rotating it in a clockwise direction
* \param center a pointer to a point indicating the point around which
* dstrect will be rotated (if NULL, rotation will be done
* around `dstrect.w / 2`, `dstrect.h / 2`)
* \param flip a SDL_RendererFlip value stating which flipping actions should
* be performed on the texture
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderTexture
* \sa SDL_SetTextureAlphaMod
* \sa SDL_SetTextureBlendMode
* \sa SDL_SetTextureColorMod
*/
extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer * renderer,
SDL_Texture * texture,
const SDL_Rect * srcrect,
const SDL_Rect * dstrect,
const double angle,
const SDL_Point *center,
const SDL_RendererFlip flip);
/**
* Draw a point on the current rendering target at subpixel precision.
*
@ -1486,8 +1150,7 @@ extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer * renderer,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_RenderPointFloat(SDL_Renderer * renderer,
float x, float y);
extern DECLSPEC int SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
/**
* Draw multiple points on the current rendering target at subpixel precision.
@ -1499,9 +1162,7 @@ extern DECLSPEC int SDLCALL SDL_RenderPointFloat(SDL_Renderer * renderer,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_RenderPointsFloat(SDL_Renderer * renderer,
const SDL_FPoint * points,
int count);
extern DECLSPEC int SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
/**
* Draw a line on the current rendering target at subpixel precision.
@ -1515,8 +1176,7 @@ extern DECLSPEC int SDLCALL SDL_RenderPointsFloat(SDL_Renderer * renderer,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_RenderLineFloat(SDL_Renderer * renderer,
float x1, float y1, float x2, float y2);
extern DECLSPEC int SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
/**
* Draw a series of connected lines on the current rendering target at
@ -1529,9 +1189,7 @@ extern DECLSPEC int SDLCALL SDL_RenderLineFloat(SDL_Renderer * renderer,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_RenderLinesFloat(SDL_Renderer * renderer,
const SDL_FPoint * points,
int count);
extern DECLSPEC int SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
/**
* Draw a rectangle on the current rendering target at subpixel precision.
@ -1543,8 +1201,7 @@ extern DECLSPEC int SDLCALL SDL_RenderLinesFloat(SDL_Renderer * renderer,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_RenderRectFloat(SDL_Renderer * renderer,
const SDL_FRect * rect);
extern DECLSPEC int SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
/**
* Draw some number of rectangles on the current rendering target at subpixel
@ -1557,9 +1214,7 @@ extern DECLSPEC int SDLCALL SDL_RenderRectFloat(SDL_Renderer * renderer,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_RenderRectsFloat(SDL_Renderer * renderer,
const SDL_FRect * rects,
int count);
extern DECLSPEC int SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
/**
* Fill a rectangle on the current rendering target with the drawing color at
@ -1572,8 +1227,7 @@ extern DECLSPEC int SDLCALL SDL_RenderRectsFloat(SDL_Renderer * renderer,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_RenderFillRectFloat(SDL_Renderer * renderer,
const SDL_FRect * rect);
extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
/**
* Fill some number of rectangles on the current rendering target with the
@ -1586,9 +1240,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRectFloat(SDL_Renderer * renderer,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_RenderFillRectsFloat(SDL_Renderer * renderer,
const SDL_FRect * rects,
int count);
extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
/**
* Copy a portion of the texture to the current rendering target at subpixel
@ -1604,10 +1256,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRectsFloat(SDL_Renderer * renderer,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_RenderTextureFloat(SDL_Renderer * renderer,
SDL_Texture * texture,
const SDL_Rect * srcrect,
const SDL_FRect * dstrect);
extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect);
/**
* Copy a portion of the source texture to the current rendering target, with
@ -1630,12 +1279,9 @@ extern DECLSPEC int SDLCALL SDL_RenderTextureFloat(SDL_Renderer * renderer,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_RenderTextureRotatedFloat(SDL_Renderer * renderer,
SDL_Texture * texture,
const SDL_Rect * srcrect,
const SDL_FRect * dstrect,
const double angle,
const SDL_FPoint *center,
extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
const SDL_Rect *srcrect, const SDL_FRect *dstrect,
const double angle, const SDL_FPoint *center,
const SDL_RendererFlip flip);
/**

View file

@ -531,33 +531,23 @@ SDL3_0.0.0 {
SDL_RenderClear;
SDL_RenderClipEnabled;
SDL_RenderFillRect;
SDL_RenderFillRectFloat;
SDL_RenderFillRects;
SDL_RenderFillRectsFloat;
SDL_RenderFlush;
SDL_RenderGeometry;
SDL_RenderGeometryRaw;
SDL_RenderGetD3D12Device;
SDL_RenderLine;
SDL_RenderLineFloat;
SDL_RenderLines;
SDL_RenderLinesFloat;
SDL_RenderLogicalToWindow;
SDL_RenderPoint;
SDL_RenderPointFloat;
SDL_RenderPoints;
SDL_RenderPointsFloat;
SDL_RenderPresent;
SDL_RenderReadPixels;
SDL_RenderRect;
SDL_RenderRectFloat;
SDL_RenderRects;
SDL_RenderRectsFloat;
SDL_RenderTargetSupported;
SDL_RenderTexture;
SDL_RenderTextureFloat;
SDL_RenderTextureRotated;
SDL_RenderTextureRotatedFloat;
SDL_RenderWindowToLogical;
SDL_ReportAssertion;
SDL_ResetAssertionReport;

View file

@ -557,33 +557,23 @@
#define SDL_RenderClear SDL_RenderClear_REAL
#define SDL_RenderClipEnabled SDL_RenderClipEnabled_REAL
#define SDL_RenderFillRect SDL_RenderFillRect_REAL
#define SDL_RenderFillRectFloat SDL_RenderFillRectFloat_REAL
#define SDL_RenderFillRects SDL_RenderFillRects_REAL
#define SDL_RenderFillRectsFloat SDL_RenderFillRectsFloat_REAL
#define SDL_RenderFlush SDL_RenderFlush_REAL
#define SDL_RenderGeometry SDL_RenderGeometry_REAL
#define SDL_RenderGeometryRaw SDL_RenderGeometryRaw_REAL
#define SDL_RenderGetD3D12Device SDL_RenderGetD3D12Device_REAL
#define SDL_RenderLine SDL_RenderLine_REAL
#define SDL_RenderLineFloat SDL_RenderLineFloat_REAL
#define SDL_RenderLines SDL_RenderLines_REAL
#define SDL_RenderLinesFloat SDL_RenderLinesFloat_REAL
#define SDL_RenderLogicalToWindow SDL_RenderLogicalToWindow_REAL
#define SDL_RenderPoint SDL_RenderPoint_REAL
#define SDL_RenderPointFloat SDL_RenderPointFloat_REAL
#define SDL_RenderPoints SDL_RenderPoints_REAL
#define SDL_RenderPointsFloat SDL_RenderPointsFloat_REAL
#define SDL_RenderPresent SDL_RenderPresent_REAL
#define SDL_RenderReadPixels SDL_RenderReadPixels_REAL
#define SDL_RenderRect SDL_RenderRect_REAL
#define SDL_RenderRectFloat SDL_RenderRectFloat_REAL
#define SDL_RenderRects SDL_RenderRects_REAL
#define SDL_RenderRectsFloat SDL_RenderRectsFloat_REAL
#define SDL_RenderTargetSupported SDL_RenderTargetSupported_REAL
#define SDL_RenderTexture SDL_RenderTexture_REAL
#define SDL_RenderTextureFloat SDL_RenderTextureFloat_REAL
#define SDL_RenderTextureRotated SDL_RenderTextureRotated_REAL
#define SDL_RenderTextureRotatedFloat SDL_RenderTextureRotatedFloat_REAL
#define SDL_RenderWindowToLogical SDL_RenderWindowToLogical_REAL
#define SDL_ReportAssertion SDL_ReportAssertion_REAL
#define SDL_ResetAssertionReport SDL_ResetAssertionReport_REAL

View file

@ -613,33 +613,23 @@ SDL_DYNAPI_PROC(Uint32,SDL_RegisterEvents,(int a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_RemoveTimer,(SDL_TimerID a),(a),return)
SDL_DYNAPI_PROC(int,SDL_RenderClear,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_RenderClipEnabled,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_RenderFillRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_RenderFillRectFloat,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_RenderFillRects,(SDL_Renderer *a, const SDL_Rect *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderFillRectsFloat,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderFillRect,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_RenderFillRects,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderFlush,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_RenderGeometry,(SDL_Renderer *a, SDL_Texture *b, const SDL_Vertex *c, int d, const int *e, int f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(int,SDL_RenderGeometryRaw,(SDL_Renderer *a, SDL_Texture *b, const float *c, int d, const SDL_Color *e, int f, const float *g, int h, int i, const void *j, int k, int l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
SDL_DYNAPI_PROC(int,SDL_RenderLine,(SDL_Renderer *a, int b, int c, int d, int e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(int,SDL_RenderLineFloat,(SDL_Renderer *a, float b, float c, float d, float e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(int,SDL_RenderLines,(SDL_Renderer *a, const SDL_Point *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderLinesFloat,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderLine,(SDL_Renderer *a, float b, float c, float d, float e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(int,SDL_RenderLines,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_RenderLogicalToWindow,(SDL_Renderer *a, float b, float c, float *d, float *e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(int,SDL_RenderPoint,(SDL_Renderer *a, int b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderPointFloat,(SDL_Renderer *a, float b, float c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderPoints,(SDL_Renderer *a, const SDL_Point *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderPointsFloat,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderPoint,(SDL_Renderer *a, float b, float c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderPoints,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_RenderPresent,(SDL_Renderer *a),(a),)
SDL_DYNAPI_PROC(int,SDL_RenderReadPixels,(SDL_Renderer *a, const SDL_Rect *b, Uint32 c, void *d, int e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(int,SDL_RenderRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_RenderRectFloat,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_RenderRects,(SDL_Renderer *a, const SDL_Rect *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderRectsFloat,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_RenderRect,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_RenderRects,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_RenderTargetSupported,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_RenderTexture,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_RenderTextureFloat,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_FRect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_RenderTextureRotated,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_Rect *d, const double e, const SDL_Point *f, const SDL_RendererFlip g),(a,b,c,d,e,f,g),return)
SDL_DYNAPI_PROC(int,SDL_RenderTextureRotatedFloat,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_FRect *d, const double e, const SDL_FPoint *f, const SDL_RendererFlip g),(a,b,c,d,e,f,g),return)
SDL_DYNAPI_PROC(int,SDL_RenderTexture,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_FRect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_RenderTextureRotated,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_FRect *d, const double e, const SDL_FPoint *f, const SDL_RendererFlip g),(a,b,c,d,e,f,g),return)
SDL_DYNAPI_PROC(void,SDL_RenderWindowToLogical,(SDL_Renderer *a, float b, float c, float *d, float *e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(SDL_AssertState,SDL_ReportAssertion,(SDL_AssertData *a, const char *b, const char *c, int d),(a,b,c,d),return)
SDL_DYNAPI_PROC(void,SDL_ResetAssertionReport,(void),(),)

View file

@ -861,8 +861,7 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
return 0;
}
int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags,
SDL_Window **window, SDL_Renderer **renderer)
int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer)
{
*window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
@ -1483,8 +1482,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
return texture;
}
int SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access,
int *w, int *h)
int SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h)
{
CHECK_TEXTURE_MAGIC(texture, -1);
@ -1521,8 +1519,7 @@ int SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
return 0;
}
int SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g,
Uint8 *b)
int SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
{
CHECK_TEXTURE_MAGIC(texture, -1);
@ -1720,8 +1717,7 @@ static int SDL_UpdateTextureNative(SDL_Texture *texture, const SDL_Rect *rect,
return 0;
}
int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect,
const void *pixels, int pitch)
int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
{
SDL_Rect real_rect;
@ -2011,8 +2007,7 @@ static int SDL_LockTextureNative(SDL_Texture *texture, const SDL_Rect *rect,
return 0;
}
int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect,
void **pixels, int *pitch)
int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
{
SDL_Rect full_rect;
@ -2050,8 +2045,7 @@ int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect,
}
}
int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect,
SDL_Surface **surface)
int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface)
{
SDL_Rect real_rect;
void *pixels = NULL;
@ -2405,9 +2399,7 @@ int SDL_SetRenderIntegerScale(SDL_Renderer *renderer, SDL_bool enable)
return UpdateLogicalSize(renderer, SDL_TRUE);
}
SDL_bool
SDLCALL
SDL_GetRenderIntegerScale(SDL_Renderer *renderer)
SDL_bool SDL_GetRenderIntegerScale(SDL_Renderer *renderer)
{
CHECK_RENDERER_MAGIC(renderer, SDL_FALSE);
@ -2554,8 +2546,7 @@ void SDL_RenderLogicalToWindow(SDL_Renderer *renderer, float logicalX, float log
}
}
int SDL_SetRenderDrawColor(SDL_Renderer *renderer,
Uint8 r, Uint8 g, Uint8 b, Uint8 a)
int SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
CHECK_RENDERER_MAGIC(renderer, -1);
@ -2566,8 +2557,7 @@ int SDL_SetRenderDrawColor(SDL_Renderer *renderer,
return 0;
}
int SDL_GetRenderDrawColor(SDL_Renderer *renderer,
Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
int SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
{
CHECK_RENDERER_MAGIC(renderer, -1);
@ -2613,101 +2603,15 @@ int SDL_RenderClear(SDL_Renderer *renderer)
return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer);
}
/* !!! FIXME: delete all the duplicate code for the integer versions in 2.1,
!!! FIXME: making the floating point versions the only available APIs. */
int SDL_RenderPoint(SDL_Renderer *renderer, int x, int y)
{
SDL_FPoint fpoint;
fpoint.x = (float)x;
fpoint.y = (float)y;
return SDL_RenderPointsFloat(renderer, &fpoint, 1);
}
int SDL_RenderPointFloat(SDL_Renderer *renderer, float x, float y)
int SDL_RenderPoint(SDL_Renderer *renderer, float x, float y)
{
SDL_FPoint fpoint;
fpoint.x = x;
fpoint.y = y;
return SDL_RenderPointsFloat(renderer, &fpoint, 1);
return SDL_RenderPoints(renderer, &fpoint, 1);
}
static int RenderPointsWithRects(SDL_Renderer *renderer,
const SDL_Point *points, const int count)
{
int retval;
SDL_bool isstack;
SDL_FRect *frects;
int i;
if (count < 1) {
return 0;
}
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
if (frects == NULL) {
return SDL_OutOfMemory();
}
for (i = 0; i < count; ++i) {
frects[i].x = points[i].x * renderer->scale.x;
frects[i].y = points[i].y * renderer->scale.y;
frects[i].w = renderer->scale.x;
frects[i].h = renderer->scale.y;
}
retval = QueueCmdFillRects(renderer, frects, count);
SDL_small_free(frects, isstack);
return retval;
}
int SDL_RenderPoints(SDL_Renderer *renderer,
const SDL_Point *points, int count)
{
SDL_FPoint *fpoints;
int i;
int retval;
SDL_bool isstack;
CHECK_RENDERER_MAGIC(renderer, -1);
if (points == NULL) {
return SDL_InvalidParamError("SDL_RenderPoints(): points");
}
if (count < 1) {
return 0;
}
#if DONT_DRAW_WHILE_HIDDEN
/* Don't draw while we're hidden */
if (renderer->hidden) {
return 0;
}
#endif
if (renderer->scale.x != 1.0f || renderer->scale.y != 1.0f) {
retval = RenderPointsWithRects(renderer, points, count);
} else {
fpoints = SDL_small_alloc(SDL_FPoint, count, &isstack);
if (fpoints == NULL) {
return SDL_OutOfMemory();
}
for (i = 0; i < count; ++i) {
fpoints[i].x = (float)points[i].x;
fpoints[i].y = (float)points[i].y;
}
retval = QueueCmdDrawPoints(renderer, fpoints, count);
SDL_small_free(fpoints, isstack);
}
return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer);
}
static int RenderPointsWithRectsF(SDL_Renderer *renderer,
const SDL_FPoint *fpoints, const int count)
static int RenderPointsWithRects(SDL_Renderer *renderer, const SDL_FPoint *fpoints, const int count)
{
int retval;
SDL_bool isstack;
@ -2737,15 +2641,14 @@ static int RenderPointsWithRectsF(SDL_Renderer *renderer,
return retval;
}
int SDL_RenderPointsFloat(SDL_Renderer *renderer,
const SDL_FPoint *points, int count)
int SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
{
int retval;
CHECK_RENDERER_MAGIC(renderer, -1);
if (points == NULL) {
return SDL_InvalidParamError("SDL_RenderPointsFloat(): points");
return SDL_InvalidParamError("SDL_RenderPoints(): points");
}
if (count < 1) {
return 0;
@ -2759,31 +2662,21 @@ int SDL_RenderPointsFloat(SDL_Renderer *renderer,
#endif
if (renderer->scale.x != 1.0f || renderer->scale.y != 1.0f) {
retval = RenderPointsWithRectsF(renderer, points, count);
retval = RenderPointsWithRects(renderer, points, count);
} else {
retval = QueueCmdDrawPoints(renderer, points, count);
}
return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer);
}
int SDL_RenderLine(SDL_Renderer *renderer, int x1, int y1, int x2, int y2)
{
SDL_FPoint points[2];
points[0].x = (float)x1;
points[0].y = (float)y1;
points[1].x = (float)x2;
points[1].y = (float)y2;
return SDL_RenderLinesFloat(renderer, points, 2);
}
int SDL_RenderLineFloat(SDL_Renderer *renderer, float x1, float y1, float x2, float y2)
int SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2)
{
SDL_FPoint points[2];
points[0].x = x1;
points[0].y = y1;
points[1].x = x2;
points[1].y = y2;
return SDL_RenderLinesFloat(renderer, points, 2);
return SDL_RenderLines(renderer, points, 2);
}
static int RenderLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x2, int y2, SDL_bool draw_last)
@ -2855,7 +2748,7 @@ static int RenderLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x2, i
}
if (renderer->scale.x != 1.0f || renderer->scale.y != 1.0f) {
retval = RenderPointsWithRectsF(renderer, points, numpixels);
retval = RenderPointsWithRects(renderer, points, numpixels);
} else {
retval = QueueCmdDrawPoints(renderer, points, numpixels);
}
@ -2939,56 +2832,14 @@ static int RenderLinesWithRectsF(SDL_Renderer *renderer,
return retval;
}
int SDL_RenderLines(SDL_Renderer *renderer,
const SDL_Point *points, int count)
{
SDL_FPoint *fpoints;
int i;
int retval;
SDL_bool isstack;
CHECK_RENDERER_MAGIC(renderer, -1);
if (points == NULL) {
return SDL_InvalidParamError("SDL_RenderLines(): points");
}
if (count < 2) {
return 0;
}
#if DONT_DRAW_WHILE_HIDDEN
/* Don't draw while we're hidden */
if (renderer->hidden) {
return 0;
}
#endif
fpoints = SDL_small_alloc(SDL_FPoint, count, &isstack);
if (fpoints == NULL) {
return SDL_OutOfMemory();
}
for (i = 0; i < count; ++i) {
fpoints[i].x = (float)points[i].x;
fpoints[i].y = (float)points[i].y;
}
retval = SDL_RenderLinesFloat(renderer, fpoints, count);
SDL_small_free(fpoints, isstack);
return retval;
}
int SDL_RenderLinesFloat(SDL_Renderer *renderer,
const SDL_FPoint *points, int count)
int SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
{
int retval = 0;
CHECK_RENDERER_MAGIC(renderer, -1);
if (points == NULL) {
return SDL_InvalidParamError("SDL_RenderLinesFloat(): points");
return SDL_InvalidParamError("SDL_RenderLines(): points");
}
if (count < 2) {
return 0;
@ -3132,23 +2983,7 @@ int SDL_RenderLinesFloat(SDL_Renderer *renderer,
return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer);
}
int SDL_RenderRect(SDL_Renderer *renderer, const SDL_Rect *rect)
{
SDL_FRect frect;
SDL_FRect *prect = NULL;
if (rect) {
frect.x = (float)rect->x;
frect.y = (float)rect->y;
frect.w = (float)rect->w;
frect.h = (float)rect->h;
prect = &frect;
}
return SDL_RenderRectFloat(renderer, prect);
}
int SDL_RenderRectFloat(SDL_Renderer *renderer, const SDL_FRect *rect)
int SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect)
{
SDL_FRect frect;
SDL_FPoint points[5];
@ -3171,11 +3006,10 @@ int SDL_RenderRectFloat(SDL_Renderer *renderer, const SDL_FRect *rect)
points[3].y = rect->y + rect->h - 1;
points[4].x = rect->x;
points[4].y = rect->y;
return SDL_RenderLinesFloat(renderer, points, 5);
return SDL_RenderLines(renderer, points, 5);
}
int SDL_RenderRects(SDL_Renderer *renderer,
const SDL_Rect *rects, int count)
int SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
{
int i;
@ -3203,54 +3037,7 @@ int SDL_RenderRects(SDL_Renderer *renderer,
return 0;
}
int SDL_RenderRectsFloat(SDL_Renderer *renderer,
const SDL_FRect *rects, int count)
{
int i;
CHECK_RENDERER_MAGIC(renderer, -1);
if (rects == NULL) {
return SDL_InvalidParamError("SDL_RenderRectsFloat(): rects");
}
if (count < 1) {
return 0;
}
#if DONT_DRAW_WHILE_HIDDEN
/* Don't draw while we're hidden */
if (renderer->hidden) {
return 0;
}
#endif
for (i = 0; i < count; ++i) {
if (SDL_RenderRectFloat(renderer, &rects[i]) < 0) {
return -1;
}
}
return 0;
}
int SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_Rect *rect)
{
SDL_FRect frect;
CHECK_RENDERER_MAGIC(renderer, -1);
/* If 'rect' == NULL, then outline the whole surface */
if (rect) {
frect.x = (float)rect->x;
frect.y = (float)rect->y;
frect.w = (float)rect->w;
frect.h = (float)rect->h;
} else {
GetRenderViewportSize(renderer, &frect);
}
return SDL_RenderFillRectsFloat(renderer, &frect, 1);
}
int SDL_RenderFillRectFloat(SDL_Renderer *renderer, const SDL_FRect *rect)
int SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect)
{
SDL_FRect frect;
@ -3261,11 +3048,10 @@ int SDL_RenderFillRectFloat(SDL_Renderer *renderer, const SDL_FRect *rect)
GetRenderViewportSize(renderer, &frect);
rect = &frect;
}
return SDL_RenderFillRectsFloat(renderer, rect, 1);
return SDL_RenderFillRects(renderer, rect, 1);
}
int SDL_RenderFillRects(SDL_Renderer *renderer,
const SDL_Rect *rects, int count)
int SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
{
SDL_FRect *frects;
int i;
@ -3306,65 +3092,7 @@ int SDL_RenderFillRects(SDL_Renderer *renderer,
return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer);
}
int SDL_RenderFillRectsFloat(SDL_Renderer *renderer,
const SDL_FRect *rects, int count)
{
SDL_FRect *frects;
int i;
int retval;
SDL_bool isstack;
CHECK_RENDERER_MAGIC(renderer, -1);
if (rects == NULL) {
return SDL_InvalidParamError("SDL_RenderFillRectsFloat(): rects");
}
if (count < 1) {
return 0;
}
#if DONT_DRAW_WHILE_HIDDEN
/* Don't draw while we're hidden */
if (renderer->hidden) {
return 0;
}
#endif
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
if (frects == NULL) {
return SDL_OutOfMemory();
}
for (i = 0; i < count; ++i) {
frects[i].x = rects[i].x * renderer->scale.x;
frects[i].y = rects[i].y * renderer->scale.y;
frects[i].w = rects[i].w * renderer->scale.x;
frects[i].h = rects[i].h * renderer->scale.y;
}
retval = QueueCmdFillRects(renderer, frects, count);
SDL_small_free(frects, isstack);
return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer);
}
int SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture,
const SDL_Rect *srcrect, const SDL_Rect *dstrect)
{
SDL_FRect dstfrect;
SDL_FRect *pdstfrect = NULL;
if (dstrect) {
dstfrect.x = (float)dstrect->x;
dstfrect.y = (float)dstrect->y;
dstfrect.w = (float)dstrect->w;
dstfrect.h = (float)dstrect->h;
pdstfrect = &dstfrect;
}
return SDL_RenderTextureFloat(renderer, texture, srcrect, pdstfrect);
}
int SDL_RenderTextureFloat(SDL_Renderer *renderer, SDL_Texture *texture,
const SDL_Rect *srcrect, const SDL_FRect *dstrect)
int SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
{
SDL_Rect real_srcrect;
SDL_FRect real_dstrect;
@ -3469,32 +3197,6 @@ int SDL_RenderTextureFloat(SDL_Renderer *renderer, SDL_Texture *texture,
}
int SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
const SDL_Rect *srcrect, const SDL_Rect *dstrect,
const double angle, const SDL_Point *center, const SDL_RendererFlip flip)
{
SDL_FRect dstfrect;
SDL_FRect *pdstfrect = NULL;
SDL_FPoint fcenter;
SDL_FPoint *pfcenter = NULL;
if (dstrect) {
dstfrect.x = (float)dstrect->x;
dstfrect.y = (float)dstrect->y;
dstfrect.w = (float)dstrect->w;
dstfrect.h = (float)dstrect->h;
pdstfrect = &dstfrect;
}
if (center) {
fcenter.x = (float)center->x;
fcenter.y = (float)center->y;
pfcenter = &fcenter;
}
return SDL_RenderTextureRotatedFloat(renderer, texture, srcrect, pdstfrect, angle, pfcenter, flip);
}
int SDL_RenderTextureRotatedFloat(SDL_Renderer *renderer, SDL_Texture *texture,
const SDL_Rect *srcrect, const SDL_FRect *dstrect,
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
{
@ -3505,7 +3207,7 @@ int SDL_RenderTextureRotatedFloat(SDL_Renderer *renderer, SDL_Texture *texture,
int use_rendergeometry;
if (flip == SDL_FLIP_NONE && (int)(angle / 360) == angle / 360) { /* fast path when we don't need rotation or flipping */
return SDL_RenderTextureFloat(renderer, texture, srcrect, dstrect);
return SDL_RenderTexture(renderer, texture, srcrect, dstrect);
}
CHECK_RENDERER_MAGIC(renderer, -1);
@ -3951,7 +3653,7 @@ static int SDLCALL SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
SDL_SetTextureAlphaMod(texture, col0_.a);
SDL_SetTextureColorMod(texture, col0_.r, col0_.g, col0_.b);
if (s.w > 0 && s.h > 0) {
SDL_RenderTextureFloat(renderer, texture, &s, &d);
SDL_RenderTexture(renderer, texture, &s, &d);
} else {
int flags = 0;
if (s.w < 0) {
@ -3964,7 +3666,7 @@ static int SDLCALL SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
s.h *= -1;
s.y -= s.h;
}
SDL_RenderTextureRotatedFloat(renderer, texture, &s, &d, 0, NULL, flags);
SDL_RenderTextureRotated(renderer, texture, &s, &d, 0, NULL, flags);
}
#if DEBUG_SW_RENDER_GEOMETRY
@ -3974,7 +3676,7 @@ static int SDLCALL SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
} else if (d.w != 0.0f && d.h != 0.0f) { /* Rect, no texture */
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(renderer, col0_.r, col0_.g, col0_.b, col0_.a);
SDL_RenderFillRectFloat(renderer, &d);
SDL_RenderFillRect(renderer, &d);
#if DEBUG_SW_RENDER_GEOMETRY
SDL_Log("Rect-FILL: RGB %d %d %d - Alpha:%d - texture=%p: dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a,
(void *)texture, d.x, d.y, d.w, d.h);
@ -4142,8 +3844,7 @@ int SDL_RenderGeometryRaw(SDL_Renderer *renderer,
return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer);
}
int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
Uint32 format, void *pixels, int pitch)
int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
{
SDL_Rect real_rect;

View file

@ -3132,7 +3132,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c)
const Uint32 charHeight = FONT_CHARACTER_SIZE;
const Uint32 charSize = FONT_CHARACTER_SIZE;
SDL_Rect srect;
SDL_Rect drect;
SDL_FRect drect;
int result;
Uint32 ix, iy;
const unsigned char *charpos;
@ -3155,10 +3155,10 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c)
/*
* Setup destination rectangle
*/
drect.x = x;
drect.y = y;
drect.w = charWidth;
drect.h = charHeight;
drect.x = (float)x;
drect.y = (float)y;
drect.w = (float)charWidth;
drect.h = (float)charHeight;
/* Character index in cache */
ci = c;

View file

@ -353,7 +353,8 @@ WatchJoystick(SDL_Joystick *joystick)
SDL_Texture *background_front, *background_back, *button, *axis, *marker = NULL;
const char *name = NULL;
SDL_Event event;
SDL_Rect dst;
SDL_FRect dst;
int texture_w, texture_h;
Uint8 alpha = 200, alpha_step = -1;
Uint64 alpha_ticks = 0;
SDL_JoystickID nJoystickID;
@ -405,9 +406,11 @@ WatchJoystick(SDL_Joystick *joystick)
break;
}
dst.x = s_arrBindingDisplay[iElement].x;
dst.y = s_arrBindingDisplay[iElement].y;
SDL_QueryTexture(marker, NULL, NULL, &dst.w, &dst.h);
SDL_QueryTexture(marker, NULL, NULL, &texture_w, &texture_h);
dst.x = (float)s_arrBindingDisplay[iElement].x;
dst.y = (float)s_arrBindingDisplay[iElement].y;
dst.w = (float)texture_w;
dst.h = (float)texture_h;
if (SDL_GetTicks() >= (alpha_ticks + 5)) {
alpha_ticks = SDL_GetTicks();

View file

@ -99,7 +99,7 @@ int render_testPrimitives(void *arg)
{
int ret;
int x, y;
SDL_Rect rect;
SDL_FRect rect;
SDL_Surface *referenceSurface = NULL;
int checkFailCount1;
int checkFailCount2;
@ -111,10 +111,10 @@ int render_testPrimitives(void *arg)
SDLTest_AssertCheck(hasDrawColor(), "_hasDrawColor");
/* Draw a rectangle. */
rect.x = 40;
rect.y = 0;
rect.w = 40;
rect.h = 80;
rect.x = 40.0f;
rect.y = 0.0f;
rect.w = 40.0f;
rect.h = 80.0f;
ret = SDL_SetRenderDrawColor(renderer, 13, 73, 200, SDL_ALPHA_OPAQUE);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
@ -123,10 +123,10 @@ int render_testPrimitives(void *arg)
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
/* Draw a rectangle. */
rect.x = 10;
rect.y = 10;
rect.w = 60;
rect.h = 40;
rect.x = 10.0f;
rect.y = 10.0f;
rect.w = 60.0f;
rect.h = 40.0f;
ret = SDL_SetRenderDrawColor(renderer, 200, 0, 100, SDL_ALPHA_OPAQUE);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
@ -146,7 +146,7 @@ int render_testPrimitives(void *arg)
checkFailCount1++;
}
ret = SDL_RenderPoint(renderer, x, y);
ret = SDL_RenderPoint(renderer, (float)x, (float)y);
if (ret != 0) {
checkFailCount2++;
}
@ -159,28 +159,28 @@ int render_testPrimitives(void *arg)
ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor");
ret = SDL_RenderLine(renderer, 0, 30, TESTRENDER_SCREEN_W, 30);
ret = SDL_RenderLine(renderer, 0.0f, 30.0f, (float)TESTRENDER_SCREEN_W, 30.0f);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderLine, expected: 0, got: %i", ret);
ret = SDL_SetRenderDrawColor(renderer, 55, 55, 5, SDL_ALPHA_OPAQUE);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
ret = SDL_RenderLine(renderer, 40, 30, 40, 60);
ret = SDL_RenderLine(renderer, 40.0f, 30.0f, 40.0f, 60.0f);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderLine, expected: 0, got: %i", ret);
ret = SDL_SetRenderDrawColor(renderer, 5, 105, 105, SDL_ALPHA_OPAQUE);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
ret = SDL_RenderLine(renderer, 0, 0, 29, 29);
ret = SDL_RenderLine(renderer, 0.0f, 0.0f, 29.0f, 29.0f);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderLine, expected: 0, got: %i", ret);
ret = SDL_RenderLine(renderer, 29, 30, 0, 59);
ret = SDL_RenderLine(renderer, 29.0f, 30.0f, 0.0f, 59.0f);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderLine, expected: 0, got: %i", ret);
ret = SDL_RenderLine(renderer, 79, 0, 50, 29);
ret = SDL_RenderLine(renderer, 79.0f, 0.0f, 50.0f, 29.0f);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderLine, expected: 0, got: %i", ret);
ret = SDL_RenderLine(renderer, 79, 59, 50, 30);
ret = SDL_RenderLine(renderer, 79.0f, 59.0f, 50.0f, 30.0f);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderLine, expected: 0, got: %i", ret);
/* See if it's the same. */
@ -209,7 +209,7 @@ int render_testPrimitivesBlend(void *arg)
{
int ret;
int i, j;
SDL_Rect rect;
SDL_FRect rect;
SDL_Surface *referenceSurface = NULL;
int checkFailCount1;
int checkFailCount2;
@ -232,10 +232,10 @@ int render_testPrimitivesBlend(void *arg)
ret = SDL_RenderFillRect(renderer, NULL);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
rect.x = 10;
rect.y = 25;
rect.w = 40;
rect.h = 25;
rect.x = 10.0f;
rect.y = 25.0f;
rect.w = 40.0f;
rect.h = 25.0f;
ret = SDL_SetRenderDrawColor(renderer, 240, 10, 10, 75);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
@ -245,10 +245,10 @@ int render_testPrimitivesBlend(void *arg)
ret = SDL_RenderFillRect(renderer, &rect);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
rect.x = 30;
rect.y = 40;
rect.w = 45;
rect.h = 15;
rect.x = 30.0f;
rect.y = 40.0f;
rect.w = 45.0f;
rect.h = 15.0f;
ret = SDL_SetRenderDrawColor(renderer, 10, 240, 10, 100);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
@ -258,10 +258,10 @@ int render_testPrimitivesBlend(void *arg)
ret = SDL_RenderFillRect(renderer, &rect);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
rect.x = 25;
rect.y = 25;
rect.w = 25;
rect.h = 25;
rect.x = 25.0f;
rect.y = 25.0f;
rect.w = 25.0f;
rect.h = 25.0f;
ret = SDL_SetRenderDrawColor(renderer, 10, 10, 240, 125);
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
@ -287,7 +287,7 @@ int render_testPrimitivesBlend(void *arg)
checkFailCount2++;
}
ret = SDL_RenderLine(renderer, 0, 0, i, 59);
ret = SDL_RenderLine(renderer, 0.0f, 0.0f, (float)i, 59.0f);
if (ret != 0) {
checkFailCount3++;
}
@ -311,7 +311,7 @@ int render_testPrimitivesBlend(void *arg)
checkFailCount2++;
}
ret = SDL_RenderLine(renderer, 0, 0, 79, i);
ret = SDL_RenderLine(renderer, 0.0f, 0.0f, 79.0f, (float)i);
if (ret != 0) {
checkFailCount3++;
}
@ -337,7 +337,7 @@ int render_testPrimitivesBlend(void *arg)
checkFailCount2++;
}
ret = SDL_RenderPoint(renderer, i, j);
ret = SDL_RenderPoint(renderer, (float)i, (float)j);
if (ret != 0) {
checkFailCount3++;
}
@ -371,7 +371,7 @@ int render_testPrimitivesBlend(void *arg)
int render_testBlit(void *arg)
{
int ret;
SDL_Rect rect;
SDL_FRect rect;
SDL_Texture *tface;
SDL_Surface *referenceSurface = NULL;
Uint32 tformat;
@ -395,8 +395,8 @@ int render_testBlit(void *arg)
/* Constant values. */
ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
rect.w = tw;
rect.h = th;
rect.w = (float)tw;
rect.h = (float)th;
ni = TESTRENDER_SCREEN_W - tw;
nj = TESTRENDER_SCREEN_H - th;
@ -405,8 +405,8 @@ int render_testBlit(void *arg)
for (j = 0; j <= nj; j += 4) {
for (i = 0; i <= ni; i += 4) {
/* Blitting. */
rect.x = i;
rect.y = j;
rect.x = (float)i;
rect.y = (float)j;
ret = SDL_RenderTexture(renderer, tface, NULL, &rect);
if (ret != 0) {
checkFailCount1++;
@ -441,7 +441,7 @@ int render_testBlit(void *arg)
int render_testBlitColor(void *arg)
{
int ret;
SDL_Rect rect;
SDL_FRect rect;
SDL_Texture *tface;
SDL_Surface *referenceSurface = NULL;
Uint32 tformat;
@ -463,8 +463,8 @@ int render_testBlitColor(void *arg)
/* Constant values. */
ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
rect.w = tw;
rect.h = th;
rect.w = (float)tw;
rect.h = (float)th;
ni = TESTRENDER_SCREEN_W - tw;
nj = TESTRENDER_SCREEN_H - th;
@ -480,8 +480,8 @@ int render_testBlitColor(void *arg)
}
/* Blitting. */
rect.x = i;
rect.y = j;
rect.x = (float)i;
rect.y = (float)j;
ret = SDL_RenderTexture(renderer, tface, NULL, &rect);
if (ret != 0) {
checkFailCount2++;
@ -517,7 +517,7 @@ int render_testBlitColor(void *arg)
int render_testBlitAlpha(void *arg)
{
int ret;
SDL_Rect rect;
SDL_FRect rect;
SDL_Texture *tface;
SDL_Surface *referenceSurface = NULL;
Uint32 tformat;
@ -542,8 +542,8 @@ int render_testBlitAlpha(void *arg)
/* Constant values. */
ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
rect.w = tw;
rect.h = th;
rect.w = (float)tw;
rect.h = (float)th;
ni = TESTRENDER_SCREEN_W - tw;
nj = TESTRENDER_SCREEN_H - th;
@ -559,8 +559,8 @@ int render_testBlitAlpha(void *arg)
}
/* Blitting. */
rect.x = i;
rect.y = j;
rect.x = (float)i;
rect.y = (float)j;
ret = SDL_RenderTexture(renderer, tface, NULL, &rect);
if (ret != 0) {
checkFailCount2++;
@ -601,7 +601,7 @@ testBlitBlendMode(SDL_Texture *tface, int mode)
Uint32 tformat;
int taccess, tw, th;
int i, j, ni, nj;
SDL_Rect rect;
SDL_FRect rect;
int checkFailCount1;
int checkFailCount2;
@ -611,8 +611,8 @@ testBlitBlendMode(SDL_Texture *tface, int mode)
/* Constant values. */
ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
rect.w = tw;
rect.h = th;
rect.w = (float)tw;
rect.h = (float)th;
ni = TESTRENDER_SCREEN_W - tw;
nj = TESTRENDER_SCREEN_H - th;
@ -628,8 +628,8 @@ testBlitBlendMode(SDL_Texture *tface, int mode)
}
/* Blitting. */
rect.x = i;
rect.y = j;
rect.x = (float)i;
rect.y = (float)j;
ret = SDL_RenderTexture(renderer, tface, NULL, &rect);
if (ret != 0) {
checkFailCount2++;
@ -652,7 +652,7 @@ testBlitBlendMode(SDL_Texture *tface, int mode)
int render_testBlitBlend(void *arg)
{
int ret;
SDL_Rect rect;
SDL_FRect rect;
SDL_Texture *tface;
SDL_Surface *referenceSurface = NULL;
Uint32 tformat;
@ -678,8 +678,8 @@ int render_testBlitBlend(void *arg)
/* Constant values. */
ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
rect.w = tw;
rect.h = th;
rect.w = (float)tw;
rect.h = (float)th;
ni = TESTRENDER_SCREEN_W - tw;
nj = TESTRENDER_SCREEN_H - th;
@ -771,8 +771,8 @@ int render_testBlitBlend(void *arg)
}
/* Blitting. */
rect.x = i;
rect.y = j;
rect.x = (float)i;
rect.y = (float)j;
ret = SDL_RenderTexture(renderer, tface, NULL, &rect);
if (ret != 0) {
checkFailCount4++;

View file

@ -41,7 +41,7 @@ int done;
void DrawPoints(SDL_Renderer *renderer)
{
int i;
int x, y;
float x, y;
SDL_Rect viewport;
/* Query the sizes */
@ -74,8 +74,8 @@ void DrawPoints(SDL_Renderer *renderer)
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
(Uint8)current_color, (Uint8)current_alpha);
x = rand() % viewport.w;
y = rand() % viewport.h;
x = (float)(rand() % viewport.w);
y = (float)(rand() % viewport.h);
SDL_RenderPoint(renderer, x, y);
}
}
@ -83,7 +83,7 @@ void DrawPoints(SDL_Renderer *renderer)
void DrawLines(SDL_Renderer *renderer)
{
int i;
int x1, y1, x2, y2;
float x1, y1, x2, y2;
SDL_Rect viewport;
/* Query the sizes */
@ -117,15 +117,15 @@ void DrawLines(SDL_Renderer *renderer)
(Uint8)current_color, (Uint8)current_alpha);
if (i == 0) {
SDL_RenderLine(renderer, 0, 0, viewport.w - 1, viewport.h - 1);
SDL_RenderLine(renderer, 0, viewport.h - 1, viewport.w - 1, 0);
SDL_RenderLine(renderer, 0, viewport.h / 2, viewport.w - 1, viewport.h / 2);
SDL_RenderLine(renderer, viewport.w / 2, 0, viewport.w / 2, viewport.h - 1);
SDL_RenderLine(renderer, 0.0f, 0.0f, (float)(viewport.w - 1), (float)(viewport.h - 1));
SDL_RenderLine(renderer, 0.0f, (float)(viewport.h - 1), (float)(viewport.w - 1), 0.0f);
SDL_RenderLine(renderer, 0.0f, (float)(viewport.h / 2), (float)(viewport.w - 1), (float)(viewport.h / 2));
SDL_RenderLine(renderer, (float)(viewport.w / 2), 0.0f, (float)(viewport.w / 2), (float)(viewport.h - 1));
} else {
x1 = (rand() % (viewport.w * 2)) - viewport.w;
x2 = (rand() % (viewport.w * 2)) - viewport.w;
y1 = (rand() % (viewport.h * 2)) - viewport.h;
y2 = (rand() % (viewport.h * 2)) - viewport.h;
x1 = (float)((rand() % (viewport.w * 2)) - viewport.w);
x2 = (float)((rand() % (viewport.w * 2)) - viewport.w);
y1 = (float)((rand() % (viewport.h * 2)) - viewport.h);
y2 = (float)((rand() % (viewport.h * 2)) - viewport.h);
SDL_RenderLine(renderer, x1, y1, x2, y2);
}
}
@ -134,7 +134,7 @@ void DrawLines(SDL_Renderer *renderer)
void DrawRects(SDL_Renderer *renderer)
{
int i;
SDL_Rect rect;
SDL_FRect rect;
SDL_Rect viewport;
/* Query the sizes */
@ -167,10 +167,10 @@ void DrawRects(SDL_Renderer *renderer)
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
(Uint8)current_color, (Uint8)current_alpha);
rect.w = rand() % (viewport.h / 2);
rect.h = rand() % (viewport.h / 2);
rect.x = (rand() % (viewport.w * 2) - viewport.w) - (rect.w / 2);
rect.y = (rand() % (viewport.h * 2) - viewport.h) - (rect.h / 2);
rect.w = (float)(rand() % (viewport.h / 2));
rect.h = (float)(rand() % (viewport.h / 2));
rect.x = (float)((rand() % (viewport.w * 2) - viewport.w) - (rect.w / 2));
rect.y = (float)((rand() % (viewport.h * 2) - viewport.h) - (rect.h / 2));
SDL_RenderFillRect(renderer, &rect);
}
}

View file

@ -29,7 +29,8 @@ int done;
void DrawChessBoard()
{
int row = 0, column = 0, x = 0;
SDL_Rect rect, darea;
SDL_FRect rect;
SDL_Rect darea;
/* Get the Size of drawing surface */
SDL_GetRenderViewport(renderer, &darea);
@ -40,10 +41,10 @@ void DrawChessBoard()
for (; column < 4 + (row % 2); column++) {
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
rect.w = darea.w / 8;
rect.h = darea.h / 8;
rect.x = x * rect.w;
rect.y = row * rect.h;
rect.w = (float)(darea.w / 8);
rect.h = (float)(darea.h / 8);
rect.x = (float)(x * rect.w);
rect.y = (float)(row * rect.h);
x = x + 2;
SDL_RenderFillRect(renderer, &rect);
}

View file

@ -687,11 +687,11 @@ void loop(void *arg)
if (SDL_GetGamepadButton(gamepad, (SDL_GamepadButton)i) == SDL_PRESSED) {
SDL_bool on_front = (i < SDL_GAMEPAD_BUTTON_PADDLE1 || i > SDL_GAMEPAD_BUTTON_PADDLE4);
if (on_front == showing_front) {
SDL_Rect dst;
dst.x = button_positions[i].x;
dst.y = button_positions[i].y;
dst.w = BUTTON_SIZE;
dst.h = BUTTON_SIZE;
SDL_FRect dst;
dst.x = (float)button_positions[i].x;
dst.y = (float)button_positions[i].y;
dst.w = (float)BUTTON_SIZE;
dst.h = (float)BUTTON_SIZE;
SDL_RenderTextureRotated(screen, button_texture, NULL, &dst, 0, NULL, SDL_FLIP_NONE);
}
}
@ -703,19 +703,19 @@ void loop(void *arg)
const Sint16 value = SDL_GetGamepadAxis(gamepad, (SDL_GamepadAxis)(i));
if (value < -deadzone) {
const double angle = axis_positions[i].angle;
SDL_Rect dst;
dst.x = axis_positions[i].x;
dst.y = axis_positions[i].y;
dst.w = AXIS_SIZE;
dst.h = AXIS_SIZE;
SDL_FRect dst;
dst.x = (float)axis_positions[i].x;
dst.y = (float)axis_positions[i].y;
dst.w = (float)AXIS_SIZE;
dst.h = (float)AXIS_SIZE;
SDL_RenderTextureRotated(screen, axis_texture, NULL, &dst, angle, NULL, SDL_FLIP_NONE);
} else if (value > deadzone) {
const double angle = axis_positions[i].angle + 180.0;
SDL_Rect dst;
dst.x = axis_positions[i].x;
dst.y = axis_positions[i].y;
dst.w = AXIS_SIZE;
dst.h = AXIS_SIZE;
SDL_FRect dst;
dst.x = (float)axis_positions[i].x;
dst.y = (float)axis_positions[i].y;
dst.w = (float)AXIS_SIZE;
dst.h = (float)AXIS_SIZE;
SDL_RenderTextureRotated(screen, axis_texture, NULL, &dst, angle, NULL, SDL_FLIP_NONE);
}
}

View file

@ -21,6 +21,11 @@ const SDL_Rect drag_areas[] = {
{ 200, 70, 100, 100 },
{ 400, 90, 100, 100 }
};
const SDL_FRect render_areas[] = {
{ 20.0f, 20.0f, 100.0f, 100.0f },
{ 200.0f, 70.0f, 100.0f, 100.0f },
{ 400.0f, 90.0f, 100.0f, 100.0f }
};
static const SDL_Rect *areas = drag_areas;
static int numareas = SDL_arraysize(drag_areas);
@ -92,7 +97,7 @@ int main(int argc, char **argv)
SDL_SetRenderDrawColor(renderer, 0, 0, 127, 255);
SDL_RenderClear(renderer);
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
SDL_RenderFillRects(renderer, areas, SDL_arraysize(drag_areas));
SDL_RenderFillRects(renderer, render_areas, SDL_arraysize(render_areas));
SDL_RenderPresent(renderer);
while (SDL_PollEvent(&e)) {

View file

@ -41,7 +41,7 @@
#define MAX_TEXT_LENGTH 256
static SDLTest_CommonState *state;
static SDL_Rect textRect, markedRect;
static SDL_FRect textRect, markedRect;
static SDL_Color lineColor = { 0, 0, 0, 255 };
static SDL_Color backColor = { 255, 255, 255, 255 };
static SDL_Color textColor = { 0, 0, 0, 255 };
@ -326,7 +326,7 @@ static int unifont_load_texture(Uint32 textureID)
return 0;
}
static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dstrect)
static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_FRect *dst)
{
SDL_Texture *texture;
const Uint32 textureID = codepoint / UNIFONT_GLYPHS_IN_TEXTURE;
@ -345,7 +345,7 @@ static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dst
const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE;
srcrect.x = cInTex % UNIFONT_GLYPHS_IN_ROW * 16;
srcrect.y = cInTex / UNIFONT_GLYPHS_IN_ROW * 16;
SDL_RenderTexture(state->renderers[rendererID], texture, &srcrect, dstrect);
SDL_RenderTexture(state->renderers[rendererID], texture, &srcrect, dst);
}
return unifontGlyph[codepoint].width;
}
@ -453,9 +453,9 @@ static void usage(void)
static void InitInput(void)
{
/* Prepare a rect for text input */
textRect.x = textRect.y = 100;
textRect.x = textRect.y = 100.0f;
textRect.w = DEFAULT_WINDOW_WIDTH - 2 * textRect.x;
textRect.h = 50;
textRect.h = 50.0f;
text[0] = 0;
markedRect = textRect;
@ -478,8 +478,8 @@ static void CleanupVideo(void)
static void _Redraw(int rendererID)
{
SDL_Renderer *renderer = state->renderers[rendererID];
SDL_Rect drawnTextRect, cursorRect, underlineRect;
drawnTextRect = textRect;
SDL_FRect drawnTextRect, cursorRect, underlineRect;
drawnTextRect.x = textRect.x;
drawnTextRect.w = 0;
SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a);
@ -504,7 +504,7 @@ static void _Redraw(int rendererID)
char *utext = text;
Uint32 codepoint;
size_t len;
SDL_Rect dstrect;
SDL_FRect dstrect;
dstrect.x = textRect.x;
dstrect.y = textRect.y + (textRect.h - 16 * UNIFONT_DRAW_SCALE) / 2;
@ -576,7 +576,7 @@ static void _Redraw(int rendererID)
char *utext = markedText;
Uint32 codepoint;
size_t len;
SDL_Rect dstrect;
SDL_FRect dstrect;
dstrect.x = drawnTextRect.x;
dstrect.y = textRect.y + (textRect.h - 16 * UNIFONT_DRAW_SCALE) / 2;
@ -614,7 +614,15 @@ static void _Redraw(int rendererID)
SDL_SetRenderDrawColor(renderer, lineColor.r, lineColor.g, lineColor.b, lineColor.a);
SDL_RenderFillRect(renderer, &cursorRect);
SDL_SetTextInputRect(&markedRect);
{
SDL_Rect inputrect;
inputrect.x = (int)markedRect.x;
inputrect.y = (int)markedRect.y;
inputrect.w = (int)markedRect.w;
inputrect.h = (int)markedRect.h;
SDL_SetTextInputRect(&inputrect);
}
}
static void Redraw(void)

View file

@ -45,7 +45,7 @@ int done;
void DrawPoints(SDL_Renderer *renderer)
{
int i;
int x, y;
float x, y;
SDL_Rect viewport;
/* Query the sizes */
@ -78,8 +78,8 @@ void DrawPoints(SDL_Renderer *renderer)
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
(Uint8)current_color, (Uint8)current_alpha);
x = rand() % viewport.w;
y = rand() % viewport.h;
x = (float)(rand() % viewport.w);
y = (float)(rand() % viewport.h);
SDL_RenderPoint(renderer, x, y);
}
}
@ -118,12 +118,12 @@ void DrawLines(SDL_Renderer *renderer)
for (i = 0; i < num_lines; ++i) {
if (i == -1) {
SDL_RenderLine(renderer, 0, 0, viewport.w - 1, viewport.h - 1);
SDL_RenderLine(renderer, 0, viewport.h - 1, viewport.w - 1, 0);
SDL_RenderLine(renderer, 0, viewport.h / 2, viewport.w - 1, viewport.h / 2);
SDL_RenderLine(renderer, viewport.w / 2, 0, viewport.w / 2, viewport.h - 1);
SDL_RenderLine(renderer, 0.0f, 0.0f, (float)(viewport.w - 1), (float)(viewport.h - 1));
SDL_RenderLine(renderer, 0.0f, (float)(viewport.h - 1), (float)(viewport.w - 1), 0.0f);
SDL_RenderLine(renderer, 0.0f, (float)(viewport.h / 2), (float)(viewport.w - 1), (float)(viewport.h / 2));
SDL_RenderLine(renderer, (float)(viewport.w / 2), 0.0f, (float)(viewport.w / 2), (float)(viewport.h - 1));
} else {
SDL_RenderLineFloat(renderer, lines[i].x, lines[i].y, lines[i].w, lines[i].h);
SDL_RenderLine(renderer, lines[i].x, lines[i].y, lines[i].w, lines[i].h);
}
}
}
@ -163,7 +163,7 @@ static void
DrawRects(SDL_Renderer *renderer)
{
SDL_SetRenderDrawColor(renderer, 255, 127, 0, 255);
SDL_RenderFillRectsFloat(renderer, rects, num_rects);
SDL_RenderFillRects(renderer, rects, num_rects);
}
static void
@ -185,7 +185,7 @@ DrawRectLineIntersections(SDL_Renderer *renderer)
y2 = lines[j].h;
if (SDL_GetRectAndLineIntersectionFloat(&r, &x1, &y1, &x2, &y2)) {
SDL_RenderLineFloat(renderer, x1, y1, x2, y2);
SDL_RenderLine(renderer, x1, y1, x2, y2);
}
}
}
@ -202,7 +202,7 @@ DrawRectRectIntersections(SDL_Renderer *renderer)
for (j = i + 1; j < num_rects; j++) {
SDL_FRect r;
if (SDL_GetRectIntersectionFloat(&rects[i], &rects[j], &r)) {
SDL_RenderFillRectFloat(renderer, &r);
SDL_RenderFillRect(renderer, &r);
}
}
}

View file

@ -91,11 +91,11 @@ PrintJoystick(SDL_Joystick *joy)
static void
DrawRect(SDL_Renderer *r, const int x, const int y, const int w, const int h)
{
SDL_Rect area;
area.x = x;
area.y = y;
area.w = w;
area.h = h;
SDL_FRect area;
area.x = (float)x;
area.y = (float)y;
area.w = (float)w;
area.h = (float)h;
SDL_RenderFillRect(r, &area);
}

View file

@ -74,9 +74,9 @@ void DrawObject(SDL_Renderer *renderer, Object *object)
rect.h = object->y2 - object->y1;
}
SDL_RenderFillRectFloat(renderer, &rect);
SDL_RenderFillRect(renderer, &rect);
} else {
SDL_RenderLineFloat(renderer, object->x1, object->y1, object->x2, object->y2);
SDL_RenderLine(renderer, object->x1, object->y1, object->x2, object->y2);
}
}
@ -226,10 +226,10 @@ void loop(void *arg)
/* Mouse wheel */
SDL_SetRenderDrawColor(renderer, 0, 255, 128, 255);
if (wheel_x_active) {
SDL_RenderLineFloat(renderer, wheel_x, 0.0f, wheel_x, (float)SCREEN_HEIGHT);
SDL_RenderLine(renderer, wheel_x, 0.0f, wheel_x, (float)SCREEN_HEIGHT);
}
if (wheel_y_active) {
SDL_RenderLineFloat(renderer, 0.0f, wheel_y, (float)SCREEN_WIDTH, wheel_y);
SDL_RenderLine(renderer, 0.0f, wheel_y, (float)SCREEN_WIDTH, wheel_y);
}
/* Objects from mouse clicks */

View file

@ -38,7 +38,7 @@ static NativeWindowFactory *factories[] = {
};
static NativeWindowFactory *factory = NULL;
static void *native_window;
static SDL_Rect *positions, *velocities;
static SDL_FRect *positions, *velocities;
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
static void
@ -56,7 +56,7 @@ void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
int sprite_w, sprite_h;
int i;
SDL_Rect viewport;
SDL_Rect *position, *velocity;
SDL_FRect *position, *velocity;
/* Query the sizes */
SDL_GetRenderViewport(renderer, &viewport);
@ -154,23 +154,23 @@ int main(int argc, char *argv[])
/* Allocate memory for the sprite info */
SDL_GetWindowSize(window, &window_w, &window_h);
SDL_QueryTexture(sprite, NULL, NULL, &sprite_w, &sprite_h);
positions = (SDL_Rect *)SDL_malloc(NUM_SPRITES * sizeof(SDL_Rect));
velocities = (SDL_Rect *)SDL_malloc(NUM_SPRITES * sizeof(SDL_Rect));
positions = (SDL_FRect *)SDL_malloc(NUM_SPRITES * sizeof(*positions));
velocities = (SDL_FRect *)SDL_malloc(NUM_SPRITES * sizeof(*velocities));
if (positions == NULL || velocities == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
quit(2);
}
srand((unsigned int)time(NULL));
for (i = 0; i < NUM_SPRITES; ++i) {
positions[i].x = rand() % (window_w - sprite_w);
positions[i].y = rand() % (window_h - sprite_h);
positions[i].w = sprite_w;
positions[i].h = sprite_h;
velocities[i].x = 0;
velocities[i].y = 0;
positions[i].x = (float)(rand() % (window_w - sprite_w));
positions[i].y = (float)(rand() % (window_h - sprite_h));
positions[i].w = (float)sprite_w;
positions[i].h = (float)sprite_h;
velocities[i].x = 0.0f;
velocities[i].y = 0.0f;
while (!velocities[i].x && !velocities[i].y) {
velocities[i].x = (rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED;
velocities[i].y = (rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED;
velocities[i].x = (float)((rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
velocities[i].y = (float)((rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
}
}

View file

@ -33,18 +33,18 @@ static unsigned int max_frames = 200;
void draw()
{
SDL_Rect Rect;
SDL_FRect rect;
SDL_SetRenderDrawColor(renderer, 0x10, 0x9A, 0xCE, 0xFF);
SDL_RenderClear(renderer);
/* Grow based on the frame just to show a difference per frame of the region */
Rect.x = 0;
Rect.y = 0;
Rect.w = (frame_number * 2) % width;
Rect.h = (frame_number * 2) % height;
rect.x = 0.0f;
rect.y = 0.0f;
rect.w = (float)((frame_number * 2) % width);
rect.h = (float)((frame_number * 2) % height);
SDL_SetRenderDrawColor(renderer, 0xFF, 0x10, 0x21, 0xFF);
SDL_RenderFillRect(renderer, &Rect);
SDL_RenderFillRect(renderer, &rect);
SDL_RenderPresent(renderer);
}

View file

@ -192,7 +192,7 @@ void MoveSprites(SDL_Renderer *renderer)
SDL_UpdateTexture(MooseTexture, NULL, MooseYUVSurfaces[i]->pixels, MooseYUVSurfaces[i]->pitch);
}
SDL_RenderClear(renderer);
SDL_RenderTextureFloat(renderer, MooseTexture, NULL, &displayrect);
SDL_RenderTexture(renderer, MooseTexture, NULL, &displayrect);
SDL_RenderPresent(renderer);
} else {
SDL_Texture *tmp;
@ -209,7 +209,7 @@ void MoveSprites(SDL_Renderer *renderer)
}
SDL_RenderClear(renderer);
SDL_RenderTextureFloat(renderer, tmp, NULL, &displayrect);
SDL_RenderTexture(renderer, tmp, NULL, &displayrect);
SDL_RenderPresent(renderer);
SDL_DestroyTexture(tmp);
}

View file

@ -25,15 +25,15 @@
static SDLTest_CommonState *state;
static int i, done;
static float mouseX, mouseY;
static SDL_Rect rect;
static SDL_FRect rect;
static SDL_Event event;
static void
DrawRects(SDL_Renderer *renderer)
{
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
rect.x = (int)mouseX;
rect.y = (int)mouseY;
rect.x = mouseX;
rect.y = mouseY;
SDL_RenderFillRect(renderer, &rect);
}

View file

@ -29,7 +29,7 @@ typedef struct
SDL_Renderer *renderer;
SDL_Texture *background;
SDL_Texture *sprite;
SDL_Rect sprite_rect;
SDL_FRect sprite_rect;
int scale_direction;
} DrawState;
@ -48,8 +48,8 @@ void Draw(DrawState *s)
{
SDL_Rect viewport;
SDL_Texture *target;
SDL_Point *center = NULL;
SDL_Point origin = { 0, 0 };
SDL_FPoint *center = NULL;
SDL_FPoint origin = { 0.0f, 0.0f };
SDL_GetRenderViewport(s->renderer, &viewport);
@ -72,8 +72,8 @@ void Draw(DrawState *s)
s->scale_direction = 1;
}
}
s->sprite_rect.x = (viewport.w - s->sprite_rect.w) / 2;
s->sprite_rect.y = (viewport.h - s->sprite_rect.h) / 2;
s->sprite_rect.x = (float)((viewport.w - s->sprite_rect.w) / 2);
s->sprite_rect.y = (float)((viewport.h - s->sprite_rect.h) / 2);
SDL_RenderTextureRotated(s->renderer, s->sprite, NULL, &s->sprite_rect, (double)s->sprite_rect.w, center, (SDL_RendererFlip)s->scale_direction);
@ -132,6 +132,7 @@ int main(int argc, char *argv[])
drawstates = SDL_stack_alloc(DrawState, state->num_windows);
for (i = 0; i < state->num_windows; ++i) {
DrawState *drawstate = &drawstates[i];
int w, h;
drawstate->window = state->windows[i];
drawstate->renderer = state->renderers[i];
@ -140,8 +141,9 @@ int main(int argc, char *argv[])
if (!drawstate->sprite || !drawstate->background) {
quit(2);
}
SDL_QueryTexture(drawstate->sprite, NULL, NULL,
&drawstate->sprite_rect.w, &drawstate->sprite_rect.h);
SDL_QueryTexture(drawstate->sprite, NULL, NULL, &w, &h);
drawstate->sprite_rect.w = (float)w;
drawstate->sprite_rect.h = (float)h;
drawstate->scale_direction = 1;
}

View file

@ -29,7 +29,7 @@ typedef struct
SDL_Renderer *renderer;
SDL_Texture *background;
SDL_Texture *sprite;
SDL_Rect sprite_rect;
SDL_FRect sprite_rect;
int scale_direction;
} DrawState;
@ -48,7 +48,8 @@ quit(int rc)
SDL_bool
DrawComposite(DrawState *s)
{
SDL_Rect viewport, R;
SDL_Rect viewport;
SDL_FRect R;
SDL_Texture *target;
static SDL_bool blend_tested = SDL_FALSE;
@ -103,8 +104,8 @@ DrawComposite(DrawState *s)
s->scale_direction = 1;
}
}
s->sprite_rect.x = (viewport.w - s->sprite_rect.w) / 2;
s->sprite_rect.y = (viewport.h - s->sprite_rect.h) / 2;
s->sprite_rect.x = (float)((viewport.w - s->sprite_rect.w) / 2);
s->sprite_rect.y = (float)((viewport.h - s->sprite_rect.h) / 2);
SDL_RenderTexture(s->renderer, s->sprite, NULL, &s->sprite_rect);
@ -113,10 +114,10 @@ DrawComposite(DrawState *s)
SDL_SetRenderDrawBlendMode(s->renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(s->renderer, 0xff, 0x00, 0x00, 0x80);
R.x = 0;
R.y = 0;
R.w = 100;
R.h = 100;
R.x = 0.0f;
R.y = 0.0f;
R.w = 100.0f;
R.h = 100.0f;
SDL_RenderFillRect(s->renderer, &R);
SDL_SetRenderDrawBlendMode(s->renderer, SDL_BLENDMODE_NONE);
@ -158,8 +159,8 @@ Draw(DrawState *s)
s->scale_direction = 1;
}
}
s->sprite_rect.x = (viewport.w - s->sprite_rect.w) / 2;
s->sprite_rect.y = (viewport.h - s->sprite_rect.h) / 2;
s->sprite_rect.x = (float)((viewport.w - s->sprite_rect.w) / 2);
s->sprite_rect.y = (float)((viewport.h - s->sprite_rect.h) / 2);
SDL_RenderTexture(s->renderer, s->sprite, NULL, &s->sprite_rect);
@ -241,6 +242,7 @@ int main(int argc, char *argv[])
drawstates = SDL_stack_alloc(DrawState, state->num_windows);
for (i = 0; i < state->num_windows; ++i) {
DrawState *drawstate = &drawstates[i];
int w, h;
drawstate->window = state->windows[i];
drawstate->renderer = state->renderers[i];
@ -253,8 +255,9 @@ int main(int argc, char *argv[])
if (!drawstate->sprite || !drawstate->background) {
quit(2);
}
SDL_QueryTexture(drawstate->sprite, NULL, NULL,
&drawstate->sprite_rect.w, &drawstate->sprite_rect.h);
SDL_QueryTexture(drawstate->sprite, NULL, NULL, &w, &h);
drawstate->sprite_rect.w = (float)w;
drawstate->sprite_rect.h = (float)h;
drawstate->scale_direction = 1;
}

View file

@ -32,7 +32,7 @@ typedef struct
SDL_Renderer *renderer;
SDL_Texture *background;
SDL_Texture *sprite;
SDL_Rect sprite_rect;
SDL_FRect sprite_rect;
int scale_direction;
} DrawState;
@ -68,8 +68,8 @@ void Draw(DrawState *s)
s->scale_direction = 1;
}
}
s->sprite_rect.x = (viewport.w - s->sprite_rect.w) / 2;
s->sprite_rect.y = (viewport.h - s->sprite_rect.h) / 2;
s->sprite_rect.x = (float)((viewport.w - s->sprite_rect.w) / 2);
s->sprite_rect.y = (float)((viewport.h - s->sprite_rect.h) / 2);
SDL_RenderTexture(s->renderer, s->sprite, NULL, &s->sprite_rect);
@ -122,6 +122,7 @@ int main(int argc, char *argv[])
drawstates = SDL_stack_alloc(DrawState, state->num_windows);
for (i = 0; i < state->num_windows; ++i) {
DrawState *drawstate = &drawstates[i];
int w, h;
drawstate->window = state->windows[i];
drawstate->renderer = state->renderers[i];
@ -130,8 +131,9 @@ int main(int argc, char *argv[])
if (!drawstate->sprite || !drawstate->background) {
quit(2);
}
SDL_QueryTexture(drawstate->sprite, NULL, NULL,
&drawstate->sprite_rect.w, &drawstate->sprite_rect.h);
SDL_QueryTexture(drawstate->sprite, NULL, NULL, &w, &h);
drawstate->sprite_rect.w = (float)w;
drawstate->sprite_rect.h = (float)h;
drawstate->scale_direction = 1;
}

View file

@ -28,12 +28,18 @@ typedef struct LoadedPicture
void render(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Rect texture_dimensions)
{
SDL_FRect dst;
/* Clear render-target to blue. */
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0xff, 0xff);
SDL_RenderClear(renderer);
/* Render the texture. */
SDL_RenderTexture(renderer, texture, &texture_dimensions, &texture_dimensions);
dst.x = (float)texture_dimensions.x;
dst.y = (float)texture_dimensions.y;
dst.w = (float)texture_dimensions.w;
dst.h = (float)texture_dimensions.h;
SDL_RenderTexture(renderer, texture, &texture_dimensions, &dst);
SDL_RenderPresent(renderer);
}

View file

@ -34,9 +34,9 @@ static SDL_bool cycle_alpha;
static int cycle_direction = 1;
static int current_alpha = 0;
static int current_color = 0;
static SDL_Rect *positions;
static SDL_Rect *velocities;
static int sprite_w, sprite_h;
static SDL_FRect *positions;
static SDL_FRect *velocities;
static float sprite_w, sprite_h;
static SDL_BlendMode blendMode = SDL_BLENDMODE_BLEND;
static Uint64 next_fps_check;
static Uint32 frames;
@ -67,11 +67,13 @@ quit(int rc)
int LoadSprite(const char *file)
{
int i;
int i, w, h;
for (i = 0; i < state->num_windows; ++i) {
/* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */
sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h);
sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &w, &h);
sprite_w = (float)w;
sprite_h = (float)h;
if (!sprites[i]) {
return -1;
}
@ -89,8 +91,9 @@ int LoadSprite(const char *file)
void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
{
int i;
SDL_Rect viewport, temp;
SDL_Rect *position, *velocity;
SDL_Rect viewport;
SDL_FRect temp;
SDL_FRect *position, *velocity;
/* Query the sizes */
SDL_GetRenderViewport(renderer, &viewport);
@ -128,22 +131,22 @@ void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
/* Test points */
SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0x00, 0xFF);
SDL_RenderPoint(renderer, 0, 0);
SDL_RenderPoint(renderer, viewport.w - 1, 0);
SDL_RenderPoint(renderer, 0, viewport.h - 1);
SDL_RenderPoint(renderer, viewport.w - 1, viewport.h - 1);
SDL_RenderPoint(renderer, 0.0f, 0.0f);
SDL_RenderPoint(renderer, (float)(viewport.w - 1), 0.0f);
SDL_RenderPoint(renderer, 0.0f, (float)(viewport.h - 1));
SDL_RenderPoint(renderer, (float)(viewport.w - 1), (float)(viewport.h - 1));
/* Test horizontal and vertical lines */
SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);
SDL_RenderLine(renderer, 1, 0, viewport.w - 2, 0);
SDL_RenderLine(renderer, 1, viewport.h - 1, viewport.w - 2, viewport.h - 1);
SDL_RenderLine(renderer, 0, 1, 0, viewport.h - 2);
SDL_RenderLine(renderer, viewport.w - 1, 1, viewport.w - 1, viewport.h - 2);
SDL_RenderLine(renderer, 1.0f, 0.0f, (float)(viewport.w - 2), 0.0f);
SDL_RenderLine(renderer, 1.0f, (float)(viewport.h - 1), (float)(viewport.w - 2), (float)(viewport.h - 1));
SDL_RenderLine(renderer, 0.0f, 1.0f, 0.0f, (float)(viewport.h - 2));
SDL_RenderLine(renderer, (float)(viewport.w - 1), 1.0f, (float)(viewport.w - 1), (float)(viewport.h - 2));
/* Test fill and copy */
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
temp.x = 1;
temp.y = 1;
temp.x = 1.0f;
temp.y = 1.0f;
temp.w = sprite_w;
temp.h = sprite_h;
if (use_rendergeometry == 0) {
@ -158,34 +161,34 @@ void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
color.b = 0xFF;
color.a = 0xFF;
verts[0].position.x = (float)temp.x;
verts[0].position.y = (float)temp.y;
verts[0].position.x = temp.x;
verts[0].position.y = temp.y;
verts[0].color = color;
verts[1].position.x = (float)temp.x + temp.w;
verts[1].position.y = (float)temp.y;
verts[1].position.x = temp.x + temp.w;
verts[1].position.y = temp.y;
verts[1].color = color;
verts[2].position.x = (float)temp.x + temp.w;
verts[2].position.y = (float)temp.y + temp.h;
verts[2].position.x = temp.x + temp.w;
verts[2].position.y = temp.y + temp.h;
verts[2].color = color;
SDL_RenderGeometry(renderer, NULL, verts, 3, NULL, 0);
verts[1].position.x = (float)temp.x;
verts[1].position.y = (float)temp.y + temp.h;
verts[1].position.x = temp.x;
verts[1].position.y = temp.y + temp.h;
verts[1].color = color;
SDL_RenderGeometry(renderer, NULL, verts, 3, NULL, 0);
}
SDL_RenderTexture(renderer, sprite, NULL, &temp);
temp.x = viewport.w - sprite_w - 1;
temp.y = 1;
temp.y = 1.0f;
temp.w = sprite_w;
temp.h = sprite_h;
SDL_RenderFillRect(renderer, &temp);
SDL_RenderTexture(renderer, sprite, NULL, &temp);
temp.x = 1;
temp.x = 1.0f;
temp.y = viewport.h - sprite_h - 1;
temp.w = sprite_w;
temp.h = sprite_h;
@ -258,43 +261,43 @@ void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
for (i = 0; i < num_sprites; ++i) {
position = &positions[i];
/* 0 */
verts->position.x = (float)position->x;
verts->position.y = (float)position->y;
verts->position.x = position->x;
verts->position.y = position->y;
verts->color = color;
verts->tex_coord.x = 0.0f;
verts->tex_coord.y = 0.0f;
verts++;
/* 1 */
verts->position.x = (float)position->x + position->w;
verts->position.y = (float)position->y;
verts->position.x = position->x + position->w;
verts->position.y = position->y;
verts->color = color;
verts->tex_coord.x = 1.0f;
verts->tex_coord.y = 0.0f;
verts++;
/* 2 */
verts->position.x = (float)position->x + position->w;
verts->position.y = (float)position->y + position->h;
verts->position.x = position->x + position->w;
verts->position.y = position->y + position->h;
verts->color = color;
verts->tex_coord.x = 1.0f;
verts->tex_coord.y = 1.0f;
verts++;
/* 0 */
verts->position.x = (float)position->x;
verts->position.y = (float)position->y;
verts->position.x = position->x;
verts->position.y = position->y;
verts->color = color;
verts->tex_coord.x = 0.0f;
verts->tex_coord.y = 0.0f;
verts++;
/* 2 */
verts->position.x = (float)position->x + position->w;
verts->position.y = (float)position->y + position->h;
verts->position.x = position->x + position->w;
verts->position.y = position->y + position->h;
verts->color = color;
verts->tex_coord.x = 1.0f;
verts->tex_coord.y = 1.0f;
verts++;
/* 3 */
verts->position.x = (float)position->x;
verts->position.y = (float)position->y + position->h;
verts->position.x = position->x;
verts->position.y = position->y + position->h;
verts->color = color;
verts->tex_coord.x = 0.0f;
verts->tex_coord.y = 1.0f;
@ -329,36 +332,36 @@ void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
for (i = 0; i < num_sprites; ++i) {
position = &positions[i];
/* 0 */
verts->position.x = (float)position->x;
verts->position.y = (float)position->y;
verts->position.x = position->x;
verts->position.y = position->y;
verts->color = color;
verts->tex_coord.x = 0.0f;
verts->tex_coord.y = 0.0f;
verts++;
/* 1 */
verts->position.x = (float)position->x + position->w;
verts->position.y = (float)position->y;
verts->position.x = position->x + position->w;
verts->position.y = position->y;
verts->color = color;
verts->tex_coord.x = 1.0f;
verts->tex_coord.y = 0.0f;
verts++;
/* 2 */
verts->position.x = (float)position->x + position->w / 2.0f;
verts->position.y = (float)position->y + position->h / 2.0f;
verts->position.x = position->x + position->w / 2.0f;
verts->position.y = position->y + position->h / 2.0f;
verts->color = color;
verts->tex_coord.x = 0.5f;
verts->tex_coord.y = 0.5f;
verts++;
/* 3 */
verts->position.x = (float)position->x;
verts->position.y = (float)position->y + position->h;
verts->position.x = position->x;
verts->position.y = position->y + position->h;
verts->color = color;
verts->tex_coord.x = 0.0f;
verts->tex_coord.y = 1.0f;
verts++;
/* 4 */
verts->position.x = (float)position->x + position->w;
verts->position.y = (float)position->y + position->h;
verts->position.x = position->x + position->w;
verts->position.y = position->y + position->h;
verts->color = color;
verts->tex_coord.x = 1.0f;
verts->tex_coord.y = 1.0f;
@ -540,8 +543,8 @@ int main(int argc, char *argv[])
}
/* Allocate memory for the sprite info */
positions = (SDL_Rect *)SDL_malloc(num_sprites * sizeof(SDL_Rect));
velocities = (SDL_Rect *)SDL_malloc(num_sprites * sizeof(SDL_Rect));
positions = (SDL_FRect *)SDL_malloc(num_sprites * sizeof(*positions));
velocities = (SDL_FRect *)SDL_malloc(num_sprites * sizeof(*velocities));
if (positions == NULL || velocities == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
quit(2);
@ -557,15 +560,15 @@ int main(int argc, char *argv[])
}
SDLTest_FuzzerInit(seed);
for (i = 0; i < num_sprites; ++i) {
positions[i].x = SDLTest_RandomIntegerInRange(0, state->window_w - sprite_w);
positions[i].y = SDLTest_RandomIntegerInRange(0, state->window_h - sprite_h);
positions[i].x = (float)SDLTest_RandomIntegerInRange(0, (int)(state->window_w - sprite_w));
positions[i].y = (float)SDLTest_RandomIntegerInRange(0, (int)(state->window_h - sprite_h));
positions[i].w = sprite_w;
positions[i].h = sprite_h;
velocities[i].x = 0;
velocities[i].y = 0;
while (!velocities[i].x && !velocities[i].y) {
velocities[i].x = SDLTest_RandomIntegerInRange(-MAX_SPEED, MAX_SPEED);
velocities[i].y = SDLTest_RandomIntegerInRange(-MAX_SPEED, MAX_SPEED);
velocities[i].x = (float)SDLTest_RandomIntegerInRange(-MAX_SPEED, MAX_SPEED);
velocities[i].y = (float)SDLTest_RandomIntegerInRange(-MAX_SPEED, MAX_SPEED);
}
}

View file

@ -28,8 +28,8 @@
#define MAX_SPEED 1
static SDL_Texture *sprite;
static SDL_Rect positions[NUM_SPRITES];
static SDL_Rect velocities[NUM_SPRITES];
static SDL_FRect positions[NUM_SPRITES];
static SDL_FRect velocities[NUM_SPRITES];
static int sprite_w, sprite_h;
SDL_Renderer *renderer;
@ -48,7 +48,7 @@ void MoveSprites()
int i;
int window_w = WINDOW_WIDTH;
int window_h = WINDOW_HEIGHT;
SDL_Rect *position, *velocity;
SDL_FRect *position, *velocity;
/* Draw a gray background */
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
@ -116,15 +116,15 @@ int main(int argc, char *argv[])
/* Initialize the sprite positions */
srand((unsigned int)time(NULL));
for (i = 0; i < NUM_SPRITES; ++i) {
positions[i].x = rand() % (WINDOW_WIDTH - sprite_w);
positions[i].y = rand() % (WINDOW_HEIGHT - sprite_h);
positions[i].w = sprite_w;
positions[i].h = sprite_h;
velocities[i].x = 0;
velocities[i].y = 0;
positions[i].x = (float)(rand() % (WINDOW_WIDTH - sprite_w));
positions[i].y = (float)(rand() % (WINDOW_HEIGHT - sprite_h));
positions[i].w = (float)sprite_w;
positions[i].h = (float)sprite_h;
velocities[i].x = 0.0f;
velocities[i].y = 0.0f;
while (!velocities[i].x && !velocities[i].y) {
velocities[i].x = (rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED;
velocities[i].y = (rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED;
velocities[i].x = (float)((rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
velocities[i].y = (float)((rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
}
}

View file

@ -43,7 +43,9 @@ quit(int rc)
void DrawOnViewport(SDL_Renderer *renderer)
{
SDL_Rect rect;
SDL_FRect rect;
SDL_Rect cliprect;
int w, h;
/* Set the viewport */
SDL_SetRenderViewport(renderer, &viewport);
@ -54,42 +56,48 @@ void DrawOnViewport(SDL_Renderer *renderer)
/* Test inside points */
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0x00, 0xFF);
SDL_RenderPoint(renderer, viewport.h / 2 + 20, viewport.w / 2);
SDL_RenderPoint(renderer, viewport.h / 2 - 20, viewport.w / 2);
SDL_RenderPoint(renderer, viewport.h / 2, viewport.w / 2 - 20);
SDL_RenderPoint(renderer, viewport.h / 2, viewport.w / 2 + 20);
SDL_RenderPoint(renderer, (float)(viewport.h / 2 + 20), (float)(viewport.w / 2));
SDL_RenderPoint(renderer, (float)(viewport.h / 2 - 20), (float)(viewport.w / 2));
SDL_RenderPoint(renderer, (float)(viewport.h / 2), (float)(viewport.w / 2 - 20));
SDL_RenderPoint(renderer, (float)(viewport.h / 2), (float)(viewport.w / 2 + 20));
/* Test horizontal and vertical lines */
SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);
SDL_RenderLine(renderer, 1, 0, viewport.w - 2, 0);
SDL_RenderLine(renderer, 1, viewport.h - 1, viewport.w - 2, viewport.h - 1);
SDL_RenderLine(renderer, 0, 1, 0, viewport.h - 2);
SDL_RenderLine(renderer, viewport.w - 1, 1, viewport.w - 1, viewport.h - 2);
SDL_RenderLine(renderer, 1.0f, 0.0f, (float)(viewport.w - 2), 0.0f);
SDL_RenderLine(renderer, 1.0f, (float)(viewport.h - 1), (float)(viewport.w - 2), (float)(viewport.h - 1));
SDL_RenderLine(renderer, 0.0f, 1.0f, 0.0f, (float)(viewport.h - 2));
SDL_RenderLine(renderer, (float)(viewport.w - 1), 1.0f, (float)(viewport.w - 1), (float)(viewport.h - 2));
/* Test diagonal lines */
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0xFF, 0xFF);
SDL_RenderLine(renderer, 0, 0, viewport.w - 1, viewport.h - 1);
SDL_RenderLine(renderer, viewport.w - 1, 0, 0, viewport.h - 1);
SDL_SetRenderDrawColor(renderer, 0x00, 0xff, 0xFF, 0xFF);
SDL_RenderLine(renderer, 0.0f, 0.0f, (float)(viewport.w - 1), (float)(viewport.h - 1));
SDL_RenderLine(renderer, (float)(viewport.w - 1), 0.0f, 0.0f, (float)(viewport.h - 1));
/* Test outside points */
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0x00, 0xFF);
SDL_RenderPoint(renderer, viewport.h / 2 + viewport.h, viewport.w / 2);
SDL_RenderPoint(renderer, viewport.h / 2 - viewport.h, viewport.w / 2);
SDL_RenderPoint(renderer, viewport.h / 2, viewport.w / 2 - viewport.w);
SDL_RenderPoint(renderer, viewport.h / 2, viewport.w / 2 + viewport.w);
SDL_RenderPoint(renderer, (float)(viewport.h / 2 + viewport.h), (float)(viewport.w / 2));
SDL_RenderPoint(renderer, (float)(viewport.h / 2 - viewport.h), (float)(viewport.w / 2));
SDL_RenderPoint(renderer, (float)(viewport.h / 2), (float)(viewport.w / 2 - viewport.w));
SDL_RenderPoint(renderer, (float)(viewport.h / 2), (float)(viewport.w / 2 + viewport.w));
/* Add a box at the top */
rect.w = 8;
rect.h = 8;
rect.x = (viewport.w - rect.w) / 2;
rect.y = 0;
rect.w = 8.0f;
rect.h = 8.0f;
rect.x = (float)((viewport.w - rect.w) / 2);
rect.y = 0.0f;
SDL_RenderFillRect(renderer, &rect);
/* Add a clip rect and fill it with the sprite */
SDL_QueryTexture(sprite, NULL, NULL, &rect.w, &rect.h);
rect.x = (viewport.w - rect.w) / 2;
rect.y = (viewport.h - rect.h) / 2;
SDL_SetRenderClipRect(renderer, &rect);
SDL_QueryTexture(sprite, NULL, NULL, &w, &h);
cliprect.x = (viewport.w - w) / 2;
cliprect.y = (viewport.h - h) / 2;
cliprect.w = w;
cliprect.h = h;
rect.x = (float)cliprect.x;
rect.y = (float)cliprect.y;
rect.w = (float)cliprect.w;
rect.h = (float)cliprect.h;
SDL_SetRenderClipRect(renderer, &cliprect);
SDL_RenderTexture(renderer, sprite, NULL, &rect);
SDL_SetRenderClipRect(renderer, NULL);
}