sdlSetStringProperty function
Set a string property in a group of properties.
This function makes a copy of the string; the caller does not have to preserve the data after this call completes.
\param props the properties to modify. \param name the name of the property to modify. \param value the new value of the property, or NULL to delete the property. \returns true on success or false on failure; call SDL_GetError() for more information.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.1.3.
\sa SDL_GetStringProperty
extern SDL_DECLSPEC bool SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, const char *name, const char *value)
Implementation
bool sdlSetStringProperty(int props, String? name, String? value) {
final sdlSetStringPropertyLookupFunction = libSdl3.lookupFunction<
Uint8 Function(Uint32 props, Pointer<Utf8> name, Pointer<Utf8> value),
int Function(int props, Pointer<Utf8> name,
Pointer<Utf8> value)>('SDL_SetStringProperty');
final namePointer = name != null ? name.toNativeUtf8() : nullptr;
final valuePointer = value != null ? value.toNativeUtf8() : nullptr;
final result =
sdlSetStringPropertyLookupFunction(props, namePointer, valuePointer) == 1;
calloc.free(namePointer);
calloc.free(valuePointer);
return result;
}