SDL_RenderTextureRotated(3)
β¨ SDL_RenderTextureRotated β¨
okay bestie, gather round, because this is the SDL3 FUNCTIONS girlie you've been waiting for: SDL_RenderTextureRotated(3). she copies a chunk of your source texture onto the current rendering target β but with rotation and flipping, and at subpixel precision no less. she's giving main character energy fr fr. π
π¦ NAME π¦
SDL_RenderTextureRotated β copy a portion of the source texture to the current rendering target, with rotation and flipping, at subpixel precision. no cap, that's literally the whole job and she ate. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_render.h>
bool SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
const SDL_FRect *srcrect, const SDL_FRect *dstrect,
double angle, const SDL_FPoint *center,
SDL_FlipMode flip);
π FUNCTION PARAMETERS π
rendererβ the renderer which should copy parts of a texture. she's the one doing the actual work, the backbone, the moment. πtextureβ the source texture. the thing you're copying from. your origin story. β¨srcrectβ a pointer to the source rectangle, orNULLfor the entire texture. like, all of it, every last pixel, no crumbs left behind. πdstrectβ a pointer to the destination rectangle, orNULLfor the entire rendering target. same energy: give her nothing and she'll take up the whole canvas. πangleβ an angle in degrees that indicates the rotation that will be applied todstrect, rotating it in a clockwise direction. clockwise bestie, not counter, iykyk. πcenterβ a pointer to a point indicating the point around whichdstrectwill be rotated. and listen: if it'sNULL, rotation will be done arounddstrect.w/2, dstrect.h/2. so the pivot defaults to the middle of your destination rect. cute. π―flipβ anSDL_FlipModevalue stating which flipping actions should be performed on the texture. mirror mirror on the wall πͺ
π RETURN VALUE π
Returns true on success or false on failure. and if it fails? don't just sit there spiraling β call SDL_GetError() for more information. she will tell you what went wrong, bestie, communication is key. π
π₯ THREAD SAFETY π₯
This function should only be called on the main thread. periodt. do not try to be sneaky on a worker thread, she is not about that life. π
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on something older, that's a vibe check you're failing, upgrade babes. π«Ά
π§ SEE ALSO π§
SDL_RenderTexture(3)β the no-rotation, no-flip sibling. still iconic, just less dramatic. π
lowkey reminder:srcrectanddstrectcan beNULL,centercan beNULL, but your main-thread energy can never beNULL. slay responsibly. π
and that's the whole page, bestie!! brought to you by the fine folks at Simple Directmedia Layer, from the SDL 3.4.18 era, and filed under the very official manual name SDL_RenderTextureRotated(3). mwah, go rotate something gorgeous. πβ¨π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms