sdlGetBooleanProperty function
Get a boolean property from a group of properties.
You can use SDL_GetPropertyType() to query whether the property exists and is a boolean 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 boolean 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_SetBooleanProperty
extern SDL_DECLSPEC bool SDLCALL SDL_GetBooleanProperty(SDL_PropertiesID props, const char *name, bool default_value)
Implementation
bool sdlGetBooleanProperty(int props, String? name, bool defaultValue) {
final sdlGetBooleanPropertyLookupFunction = libSdl3.lookupFunction<
Uint8 Function(Uint32 props, Pointer<Utf8> name, Uint8 defaultValue),
int Function(int props, Pointer<Utf8> name,
int defaultValue)>('SDL_GetBooleanProperty');
final namePointer = name != null ? name.toNativeUtf8() : nullptr;
final result = sdlGetBooleanPropertyLookupFunction(
props, namePointer, defaultValue ? 1 : 0) ==
1;
calloc.free(namePointer);
return result;
}