sdlSetWindowTitle function video

bool sdlSetWindowTitle(
  1. Pointer<SdlWindow> window,
  2. String? title
)

Set the title of a window.

This string is expected to be in UTF-8 encoding.

\param window the window to change. \param title the desired window title in UTF-8 format. \returns true on success or false on failure; call SDL_GetError() for more information.

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

\since This function is available since SDL 3.2.0.

\sa SDL_GetWindowTitle

extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowTitle(SDL_Window *window, const char *title)

Implementation

bool sdlSetWindowTitle(Pointer<SdlWindow> window, String? title) {
  final sdlSetWindowTitleLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(Pointer<SdlWindow> window, Pointer<Utf8> title),
        int Function(Pointer<SdlWindow> window, Pointer<Utf8> title)
      >('SDL_SetWindowTitle');
  final titlePointer = title != null ? title.toNativeUtf8() : nullptr;
  final result = sdlSetWindowTitleLookupFunction(window, titlePointer) == 1;
  calloc.free(titlePointer);
  return result;
}