sdlxCreateWindowAndRenderer function render

({Pointer<SdlRenderer> renderer, Pointer<SdlWindow> window})? sdlxCreateWindowAndRenderer(
  1. String title,
  2. int width,
  3. int height,
  4. int windowFlags,
)

Create a window and default renderer.

\param title the title of the window, in UTF-8 encoding. \param width the width of the window. \param height the height of the window. \param window_flags the flags used to create the window (see SDL_CreateWindow()). \param window a pointer filled with the window, or NULL on error. \param renderer a pointer filled with the renderer, or NULL on error. \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_CreateRenderer \sa SDL_CreateWindow

extern SDL_DECLSPEC bool SDLCALL SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer)

See also:

Implementation

({Pointer<SdlWindow> window, Pointer<SdlRenderer> renderer})?
sdlxCreateWindowAndRenderer(
  String title,
  int width,
  int height,
  int windowFlags,
) => ffi.using((arena) {
  final windowPointer = arena<Pointer<SdlWindow>>();
  final rendererPointer = arena<Pointer<SdlRenderer>>();

  if (!sdlCreateWindowAndRenderer(
    title,
    width,
    height,
    windowFlags,
    windowPointer,
    rendererPointer,
  )) {
    return null;
  }

  return (window: windowPointer.value, renderer: rendererPointer.value);
});