Name
sdl.RenderCopy -- draw texture
Synopsis
sdl.RenderCopy(display, tex[, src, dst, angle, center, flip])
Function
Use this function to copy a portion of the texture specified by tex to the display specified by display, optionally rotating it by angle around the given center point and also flipping it top-bottom and/or left-right. The tex argument must simply be the identifier of a hardware brush.

If specified, src and dst must be tables containing the following fields:

x
Left position of rectangle.

y
Top position of rectangle.

w
Rectangle width.

h
Rectangle height.

Alternatively, you can also set src and/or dst to Nil. Passing Nil in src and/or dst means to use the entire size of the source or destination, respectively. If source and destination sizes do not match, sdl.RenderCopy() will automatically stretch the texture to fit to the destination rectangle.

If specified, center must be a table containing the following fields:

x
Left position of center point.

y
Top position of center point.

Alternatively, you can also set center to Nil. In that case, the center point will be set to the center of the destination rectangle.

If specified, flip must be a combination of the following predefined constants:

#SDL_FLIP_NONE
Do not flip
#SDL_FLIP_HORIZONTAL
Flip horizontally
#SDL_FLIP_VERTICAL
Flip vertically

The texture is blended with the destination based on its blend mode set with sdl.SetTextureBlendMode().

The texture color is affected based on its color modulation set by sdl.SetTextureColorMod().

The texture alpha is affected based on its alpha modulation set by sdl.SetTextureAlphaMod().

Inputs
display
identifier of display whose renderer should be used
tex
identifier of hardware brush
src
optional: rectangle in the texture to use (defaults to Nil which means use the whole texture)
dst
optional: rectangle to draw to the display (defaults to Nil which means fill the entire display)
angle
optional: angle in degrees to apply to the destination rectangle in clockwise direction (defaults to 0)
center
optional: point around which to rotate the destination rectangle (defaults to Nil which means destination rectangle center)
flip
optional: flipping actions that should be performed (defaults to #SDL_FLIP_NONE)

Show TOC