texture method
Copy a portion of the texture to the current rendering target at subpixel precision.
\param renderer the renderer which should copy parts of a texture. \param texture the source texture. \param srcrect a pointer to the source rectangle, or NULL for the entire texture. \param dstrect a pointer to the destination rectangle, or NULL for the entire rendering target. \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.1.3.
\sa SDL_RenderTextureRotated \sa SDL_RenderTextureTiled
extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect)
Implementation
bool texture(Pointer<SdlTexture> texture,
{math.Rectangle<double>? srcrect, math.Rectangle<double>? dstrect}) {
Pointer<SdlFRect> srcrectPointer = nullptr;
Pointer<SdlFRect> dstrectPointer = nullptr;
if (srcrect != null) {
srcrectPointer = srcrect.calloc();
}
if (dstrect != null) {
dstrectPointer = dstrect.calloc();
}
var result =
sdlRenderTexture(this, texture, srcrectPointer, dstrectPointer);
calloc.free(srcrectPointer);
calloc.free(dstrectPointer);
return result;
}