sdlGetNumberProperty function

int sdlGetNumberProperty(
  1. int props,
  2. String? name,
  3. int defaultValue
)

Get a number property from a group of properties.

You can use SDL_GetPropertyType() to query whether the property exists and is a number 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 number 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_SetNumberProperty

extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 default_value)

Implementation

int sdlGetNumberProperty(int props, String? name, int defaultValue) {
  final sdlGetNumberPropertyLookupFunction = libSdl3.lookupFunction<
      Int64 Function(Uint32 props, Pointer<Utf8> name, Int64 defaultValue),
      int Function(int props, Pointer<Utf8> name,
          int defaultValue)>('SDL_GetNumberProperty');
  final namePointer = name != null ? name.toNativeUtf8() : nullptr;
  final result =
      sdlGetNumberPropertyLookupFunction(props, namePointer, defaultValue);
  calloc.free(namePointer);
  return result;
}