sdlCreateTexture function render

Pointer<SdlTexture> sdlCreateTexture(
  1. Pointer<SdlRenderer> renderer,
  2. int format,
  3. int access,
  4. int w,
  5. int h,
)

Create a texture for a rendering context.

The contents of a texture when first created are not defined.

\param renderer the rendering context. \param format one of the enumerated values in SDL_PixelFormat. \param access one of the enumerated values in SDL_TextureAccess. \param w the width of the texture in pixels. \param h the height of the texture in pixels. \returns the created texture or NULL 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_CreateTextureFromSurface \sa SDL_CreateTextureWithProperties \sa SDL_DestroyTexture \sa SDL_GetTextureSize \sa SDL_UpdateTexture

extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormat format, SDL_TextureAccess access, int w, int h)

Implementation

Pointer<SdlTexture> sdlCreateTexture(
  Pointer<SdlRenderer> renderer,
  int format,
  int access,
  int w,
  int h,
) {
  final sdlCreateTextureLookupFunction = _libSdl
      .lookupFunction<
        Pointer<SdlTexture> Function(
          Pointer<SdlRenderer> renderer,
          Int32 format,
          Int32 access,
          Int32 w,
          Int32 h,
        ),
        Pointer<SdlTexture> Function(
          Pointer<SdlRenderer> renderer,
          int format,
          int access,
          int w,
          int h,
        )
      >('SDL_CreateTexture');
  return sdlCreateTextureLookupFunction(renderer, format, access, w, h);
}