SDL_GetSurfaceImages(3)

πŸ’– SDL_GetSurfaceImages πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, this one's called SDL_GetSurfaceImages and it's literally about collecting every version of a surface into one lil array. no cap. πŸ¦‹


✨ NAME ✨

SDL_GetSurfaceImages β€” get an array including all versions of a surface. yes, ALL of them, the whole girl squad. πŸ‘‘


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_surface.h>

SDL_Surface ** SDL_GetSurfaceImages(SDL_Surface *surface, int *count);

πŸ’… DESCRIPTION πŸ’…

So basically this returns all versions of a surface, and the surface you're querying is the first element in the returned array. main character gets the front seat, as she should. πŸ’–

Now listen, important part: freeing the array of surfaces does not affect the surfaces inside the array. They're still referenced by the surface you queried and they'll get cleaned up normally on their own. so like, free the array, don't panic, the surfaces are fine. 🫢


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • surface β€” the SDL_Surface structure you wanna query. the one we're investigating. πŸ”
  • count β€” a pointer that gets filled in with the number of surface pointers returned. it may be NULL if you don't care, and honestly? valid. πŸ’…

⭐ RETURN VALUE ⭐

Returns a NULL terminated array of SDL_Surface pointers, or NULL on failure. and if it fails? call SDL_GetError() for more info, she'll tell you what went wrong. 😭

This should be freed with SDL_free() when it is no longer needed. don't forget, bestie, that's a leak waiting to happen. 🚨


🧚 THREAD SAFETY 🧚

This function can be called on different threads with different surfaces. so you and your mutuals can each do your own thing with your own surfaces, no drama. ✨


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. if you're on something older... it's giving not yet, sorry babe. πŸ’€


πŸ”₯ SEE ALSO πŸ”₯

go read those too, they're all in the same friend group. 🫢


and that's the whole vibe check πŸ’œ this page came to you from the Simple Directmedia Layer girlies, SDL 3.4.18, dated however old this doc is β€” mwah, stay slaying, and remember: free your arrays. πŸ’…βœ¨

πŸ“¦ where this page comes from