SDL_GetPointerProperty(3)
β¨ SDL_GetPointerProperty(3) β¨
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_GetPointerProperty π
she's a little function that goes digging through a pile of properties and pulls out a pointer for you. no cap.
πΈ NAME πΈ
SDL_GetPointerProperty β get a pointer property out of a whole group of properties. yes, a group. she's not picking one lonely property, she's scanning the whole friend group π«Ά
π SYNOPSIS π
#include <SDL3/SDL_properties.h>
void * SDL_GetPointerProperty(SDL_PropertiesID props, const char *name, void *default_value);
look at her. iconic. three args, one pointer, zero drama β¨
π¦ DESCRIPTION π¦
so, by convention (and conventions are just ~vibes with consequences~), the names of properties that SDL exposes on objects start with "SDL." β like, that's the public-facing aesthetic, that's the main character energy π
and the properties SDL uses internally start with "SDL.internal." β those ones are the backstage crew, the stagehands, the ones you do NOT talk to π
both of those groups should be considered read-only and should not be modified by applications. fr fr. hands off, bestie. don't touch the internals. that's not your business, that's not my business, that's nobody's business π
π FUNCTION PARAMETERS π
propsβ the properties to query. this is the group chat you're scrolling through πnameβ the name of the property you're looking for. this is the @ mention, the name tag, the "hey you" πdefault_valueβ the default value of the property. this is the outfit she wears if she can't find anything better. the fallback fit π
β RETURN VALUE β
she returns the value of the property π«Ά
OR, if it is not set, or it's not a pointer property, she hands you back default_value instead. no crumbs, no drama, just the backup plan π
π₯ THREAD SAFETY π₯
okay so it is safe to call this function from any thread π β go off, queen, multithread away.
BUT. (there's always a but, isn't there π) the data returned is not protected, and it could potentially be freed if you call SDL_SetPointerProperty() or SDL_ClearProperty() on these properties from another thread. like, she handed you the pointer and somebody else yanked the rug. π
if you need to avoid this, useSDL_LockProperties()andSDL_UnlockProperties(). lock it down, babe π
π AVAILABILITY π
this function is available since SDL 3.2.0. she's not new-new, but she's not ancient either. a queen in her prime β¨
π§ SEE ALSO π§
SDL_GetBooleanProperty(3)SDL_GetFloatProperty(3)SDL_GetNumberProperty(3)SDL_GetPropertyType(3)SDL_GetStringProperty(3)SDL_HasProperty(3)SDL_SetPointerProperty(3)
the whole squad π«Ά go read them too, iykyk π
and that's the tea, bestie π this has been brought to you by Simple Directmedia Layer, version SDL 3.4.18 (no date on the tin, but honestly? timeless π). stay hydrated, lock your properties, and don't modify the "SDL.internal." ones. periodt π
β¨
π¦ 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