SDL_SetRenderDrawColorFloat(3)
π SDL_SetRenderDrawColorFloat(3) π
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_SetRenderDrawColorFloat β she's the one who picks the color for all your drawing ops. Rect, Line, Clear? Yeah, all of them. She runs the vibe check on your palette. π¨β¨
β¨ NAME β¨
SDL_SetRenderDrawColorFloat β set the color used for drawing operations (Rect, Line and Clear). slay.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_render.h>
bool SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a);
π¦ DESCRIPTION π¦
So like. This is the function that sets the color for drawing or filling rectangles, lines, and points β and also for SDL_RenderClear(). literally the entire aesthetic of your frame, no big deal. π«Ά
If you want your rects to be a certain color, this is where you manifest it. Obsessed with her, honestly.
π FUNCTION PARAMETERS π
rendererβ the rendering context. it's giving "the whole world we're painting on" energy πrβ the red value used to draw on the rendering target. red!! πgβ the green value used to draw on the rendering target. green!! πΏbβ the blue value used to draw on the rendering target. blue!! π¦aβ the alpha value used to draw on the rendering target. useSDL_SetRenderDrawBlendModeto specify how the alpha channel is used β like, alpha does NOT just do its own thing, you have to tell it what the blend situation is. periodt. π«§
π RETURN VALUE π
Returns true on success or false on failure. and if it fails?? call SDL_GetError() for more information, bestie β she will tell you what went wrong. π
π₯ THREAD SAFETY π₯
This function should only be called on the main thread. main character energy only, no side quests on other threads. π
β AVAILABILITY β
This function is available since SDL 3.2.0. so if you're on something older... girl, upgrade. π
π SEE ALSO π
and that's the whole page, no cap β she ate and left zero crumbs. go forth and color your rectangles. π β¨
this has been a Simple Directmedia Layer production, brought to you by SDL 3.4.18 β mwah, ilysm, go make something pretty ππ¦π
π¦ 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