sdlHasProperty function

bool sdlHasProperty(
  1. int props,
  2. String? name
)

Return whether a property exists in a group of properties.

\param props the properties to query. \param name the name of the property to query. \returns true if the property exists, or false if it doesn't.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_GetPropertyType

extern SDL_DECLSPEC bool SDLCALL SDL_HasProperty(SDL_PropertiesID props, const char *name)

Implementation

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