SDL_GetNumberProperty(3)

πŸ’– SDL_GetNumberProperty πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we are pulling a number property out of a whole lil group of properties ✨ it's giving "reach into the bag and grab the number" energy and honestly? obsessed.


✨ NAME ✨

SDL_GetNumberProperty β€” get a number property from a group of properties πŸŽ€


✨ SYNOPSIS ✨

#include <SDL3/SDL_properties.h>

Sint64 SDL_GetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 default_value);

✨ DESCRIPTION ✨

so like, you hand it a property name, it hands you back a number. slay. πŸ’…

and if you're sitting there like "bestie… does this property even exist?? is it even a number tho??" β€” you can use SDL_GetPropertyType() to query whether the property exists and is a number property πŸ¦‹ no guessing required, no cap.


✨ FUNCTION PARAMETERS ✨

  • props β€” the properties to query 🌸 like, the whole group you're digging through.
  • name β€” the name of the property to query πŸ’œ the one you're looking for by name, main character style.
  • default_value β€” the default value of the property πŸŽ€ your lil fallback bff, waiting patiently in case things don't work out.

✨ RETURN VALUE ✨

Returns the value of the property πŸ”₯ or, if it is not set or not a number property, it just gives you back default_value 🫢 no drama, no crash, just the fallback. periodt.


✨ THREAD SAFETY ✨

It is safe to call this function from any thread 🌈 fr fr, any thread, go wild, call it from wherever you want. iconic behaviour honestly.


✨ AVAILABILITY ✨

This function is available since SDL 3.2.0 ⭐ so if you're on something older… yeah, that's a vibe check you're failing, bestie 😭


✨ SEE ALSO ✨

iykyk β€” go read those next, they're the whole friend group πŸ¦‹


lowkey important: this one only does numbers. if the property is set but it's a different type, you're getting default_value back, not a surprise conversion. πŸ™ˆ

and that's the whole page bestie!! brought to you by Simple Directmedia Layer πŸ’œ running the SDL 3.4.18 era, and yes this is SDL_GetNumberProperty(3) signing off πŸ‘‘ go get those numbers, you ate πŸ’…πŸŒΈ

πŸ“¦ where this page comes from