sdlCreateWindowAndRenderer function render

bool sdlCreateWindowAndRenderer(
  1. String? title,
  2. int width,
  3. int height,
  4. int windowFlags,
  5. Pointer<Pointer<SdlWindow>> window,
  6. Pointer<Pointer<SdlRenderer>> renderer,
)

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)

Implementation

bool sdlCreateWindowAndRenderer(
  String? title,
  int width,
  int height,
  int windowFlags,
  Pointer<Pointer<SdlWindow>> window,
  Pointer<Pointer<SdlRenderer>> renderer,
) {
  final sdlCreateWindowAndRendererLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(
          Pointer<Utf8> title,
          Int32 width,
          Int32 height,
          Uint64 windowFlags,
          Pointer<Pointer<SdlWindow>> window,
          Pointer<Pointer<SdlRenderer>> renderer,
        ),
        int Function(
          Pointer<Utf8> title,
          int width,
          int height,
          int windowFlags,
          Pointer<Pointer<SdlWindow>> window,
          Pointer<Pointer<SdlRenderer>> renderer,
        )
      >('SDL_CreateWindowAndRenderer');
  final titlePointer = title != null ? title.toNativeUtf8() : nullptr;
  final result =
      sdlCreateWindowAndRendererLookupFunction(
        titlePointer,
        width,
        height,
        windowFlags,
        window,
        renderer,
      ) ==
      1;
  calloc.free(titlePointer);
  return result;
}