sdlCreateSoftwareRenderer function

Pointer<SdlRenderer> sdlCreateSoftwareRenderer(
  1. Pointer<SdlSurface> surface
)

Create a 2D software rendering context for a surface.

Two other API which can be used to create SDL_Renderer: SDL_CreateRenderer() and SDL_CreateWindowAndRenderer(). These can also create a software renderer, but they are intended to be used with an SDL_Window as the final destination and not an SDL_Surface.

\param surface the SDL_Surface structure representing the surface where rendering is done. \returns a valid rendering context or NULL if there was an error; 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.1.3.

\sa SDL_DestroyRenderer

extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface *surface)

Implementation

Pointer<SdlRenderer> sdlCreateSoftwareRenderer(Pointer<SdlSurface> surface) {
  final sdlCreateSoftwareRendererLookupFunction = libSdl3.lookupFunction<
      Pointer<SdlRenderer> Function(Pointer<SdlSurface> surface),
      Pointer<SdlRenderer> Function(
          Pointer<SdlSurface> surface)>('SDL_CreateSoftwareRenderer');
  return sdlCreateSoftwareRendererLookupFunction(surface);
}