SDL_RenderLine(3)

πŸ’… SDL_RenderLine β€” it's giving line drawing, bestie

okay so you wanna know about SDL_RenderLine(3)? it lives in the SDL3 FUNCTIONS section of the manual and honestly? it's iconic. it draws a line on the current rendering target at subpixel precision β€” like, not just whole pixels, subpixel, we're fancy here ✨


🌸 NAME 🌸

SDL_RenderLine β€” draws a line on the current rendering target at subpixel precision πŸ’–


✨ SYNOPSIS ✨

#include <SDL3/SDL_render.h>

bool SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);

look at her. bool. four floats. she's beauty, she's grace πŸŽ€


🫢 FUNCTION PARAMETERS 🫢

  • renderer β€” the renderer that's gonna do the actual drawing of the line. give her the right one pls πŸ™ˆ
  • x1 β€” the x coordinate of the start point πŸ“
  • y1 β€” the y coordinate of the start point πŸ“
  • x2 β€” the x coordinate of the end point 🏁
  • y2 β€” the y coordinate of the end point 🏁

πŸ’€ RETURN VALUE πŸ’€

returns true on success, or false on failure. and if it's a false? bestie, call SDL_GetError() for more info, because she will tell you what went wrong. no cap. 😭


🧡 THREAD SAFETY 🧡

⚠️ this function should only be called on the main thread. not the side threads, not the background threads, the main one. periodt. πŸ‘‘

🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0 β€” so if you're on something older, sorry babe, she's not there yet πŸ’”


πŸ‘€ SEE ALSO πŸ‘€

  • SDL_RenderLines(3) β€” the plural version, for when one line just isn't enough, iykyk πŸ¦‹

and that's the whole vibe check, bestie. go draw some gorgeous subpixel lines and slay πŸ’…βœ¨

with love from the Simple Directmedia Layer girlies, SDL 3.4.18 era, SDL_RenderLine(3) forever πŸŽ€

πŸ“¦ where this page comes from