sdlSetPointerProperty function

bool sdlSetPointerProperty(
  1. int props,
  2. String? name,
  3. Pointer<NativeType> value
)

Set a pointer property in a group of properties.

\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_GetPointerProperty \sa SDL_HasProperty \sa SDL_SetBooleanProperty \sa SDL_SetFloatProperty \sa SDL_SetNumberProperty \sa SDL_SetPointerPropertyWithCleanup \sa SDL_SetStringProperty

extern SDL_DECLSPEC bool SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, const char *name, void *value)

Implementation

bool sdlSetPointerProperty(int props, String? name, Pointer<NativeType> value) {
  final sdlSetPointerPropertyLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(
          Uint32 props, Pointer<Utf8> name, Pointer<NativeType> value),
      int Function(int props, Pointer<Utf8> name,
          Pointer<NativeType> value)>('SDL_SetPointerProperty');
  final namePointer = name != null ? name.toNativeUtf8() : nullptr;
  final result =
      sdlSetPointerPropertyLookupFunction(props, namePointer, value) == 1;
  calloc.free(namePointer);
  return result;
}