sdlGetFloatProperty function
Get a floating point property from a group of properties.
You can use SDL_GetPropertyType() to query whether the property exists and is a floating point property.
\param props the properties to query.
\param name the name of the property to query.
\param default_value the default value of the property.
\returns the value of the property, or default_value
if it is not set or
not a float property.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.1.3.
\sa SDL_GetPropertyType \sa SDL_HasProperty \sa SDL_SetFloatProperty
extern SDL_DECLSPEC float SDLCALL SDL_GetFloatProperty(SDL_PropertiesID props, const char *name, float default_value)
Implementation
double sdlGetFloatProperty(int props, String? name, double defaultValue) {
final sdlGetFloatPropertyLookupFunction = libSdl3.lookupFunction<
Float Function(Uint32 props, Pointer<Utf8> name, Float defaultValue),
double Function(int props, Pointer<Utf8> name,
double defaultValue)>('SDL_GetFloatProperty');
final namePointer = name != null ? name.toNativeUtf8() : nullptr;
final result =
sdlGetFloatPropertyLookupFunction(props, namePointer, defaultValue);
calloc.free(namePointer);
return result;
}