SDL_GetVideoDriver(3)

πŸ’– SDL_GetVideoDriver(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we are about to get the name of a built in video driver. yes. that's it. that's the whole job. and she does it flawlessly, no cap. πŸŽ€


✨ NAME ✨

SDL_GetVideoDriver β€” Get the name of a built in video driver.

like, literally just the name. she's not launching anything, she's not configuring anything, she's just handing you the receipt. πŸ§ΎπŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_video.h>

const char * SDL_GetVideoDriver(int index);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: the video drivers are presented in the order in which they are normally checked during initialization. so like, index 0 isn't "the best one" or "the main character" β€” she's just first in line when SDL goes down the list. the order is the information, iykyk. πŸ”₯

and the names themselves? the names of drivers are all simple, low-ASCII identifiers, like "cocoa", "x11" or "windows". these never have Unicode characters β€” not a single one, not even a sneaky emoji, we stay disciplined β€” and they are not meant to be proper names. so don't go showing them off at a dinner party as if they're legal names, they're more like... usernames. handles. lowercase little gremlins. πŸ™ˆ


πŸ‘‘ FUNCTION PARAMETERS πŸ‘‘

  • index β€” the index of a video driver. that's the vibe. just a number. πŸ’œ

⭐ RETURN VALUE ⭐

returns the name of the video driver with the given index, or NULL if index is out of bounds. so if you're color-coding your life: got a string back? slay. got NULL? you went too far, babe, there's nothing over there. 😭


πŸ’€ THREAD SAFETY πŸ’€

this function should only be called on the main thread. that's it. that's the rule. don't be out here calling her from some random thread like it's a group chat at 2am. main thread only, periodt. 🫢


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0. so if you're on anything older, she simply does not exist for you yet, and that's just the timeline we're in. πŸ•°οΈ


πŸ“ SEE ALSO πŸ“

  • SDL_GetNumVideoDrivers(3) β€” go check how many of these lil guys there even are before you start indexing into the void. πŸŽ€

🧚 bye bestie 🧚

that's the whole page!! this one came from Simple Directmedia Layer, rocking SDL 3.4.18, and it was documented for us on the same day as the SDL_GetVideoDriver(3) header up top says. go forth, loop over your drivers, and stay in bounds. mwah. πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from