sdlGetWindowData function

Pointer<NativeType> sdlGetWindowData(
  1. Pointer<SdlWindow> window,
  2. String? name
)

Retrieve the data pointer associated with a window.

\param window the window to query \param name the name of the pointer \returns the value associated with name.

\since This function is available since SDL 2.0.0.

\sa SDL_SetWindowData

extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, const char *name)

Implementation

Pointer<NativeType> sdlGetWindowData(Pointer<SdlWindow> window, String? name) {
  final sdlGetWindowDataLookupFunction = libSdl2.lookupFunction<
      Pointer<NativeType> Function(
          Pointer<SdlWindow> window, Pointer<Utf8> name),
      Pointer<NativeType> Function(
          Pointer<SdlWindow> window, Pointer<Utf8> name)>('SDL_GetWindowData');
  final namePointer = name != null ? name.toNativeUtf8() : nullptr;
  final result = sdlGetWindowDataLookupFunction(window, namePointer);
  calloc.free(namePointer);
  return result;
}