Added SDL_RenderTextureTiled()

This commit is contained in:
Sam Lantinga 2024-07-20 13:47:01 -07:00
parent 9e55ee9391
commit 198caa54a1
6 changed files with 385 additions and 71 deletions

View file

@ -1843,6 +1843,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, cons
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderTextureRotated
* \sa SDL_RenderTextureTiled
*/
extern SDL_DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect);
@ -1875,6 +1876,28 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer,
const double angle, const SDL_FPoint *center,
const SDL_FlipMode flip);
/**
* Tile a portion of the texture to the current rendering target at subpixel
* precision.
*
* The pixels in `srcrect` will be repeated as many times as needed to completely fill `dstrect`.
*
* \param renderer the renderer which should copy parts of a texture.
* \param texture the source texture.
* \param srcrect a pointer to the source rectangle, or NULL for the entire
* texture.
* \param scale the scale used to transform srcrect into the destination rectangle, e.g. a 32x32 texture with a scale of 2 would fill 64x64 tiles.
* \param dstrect a pointer to the destination rectangle, 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_RenderTexture
*/
extern SDL_DECLSPEC int SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float scale, const SDL_FRect *dstrect);
/**
* Render a list of triangles, optionally using a texture and indices into the
* vertex array Color and alpha modulation is done per vertex