sdlGetWindowTitle function

String? sdlGetWindowTitle(
  1. Pointer<SdlWindow> window
)

Get the title of a window.

\param window the window to query. \returns the title of the window in UTF-8 format or "" if there is no title.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.1.3.

\sa SDL_SetWindowTitle

extern SDL_DECLSPEC const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window)

Implementation

String? sdlGetWindowTitle(Pointer<SdlWindow> window) {
  final sdlGetWindowTitleLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Pointer<SdlWindow> window),
      Pointer<Utf8> Function(Pointer<SdlWindow> window)>('SDL_GetWindowTitle');
  final result = sdlGetWindowTitleLookupFunction(window);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}