Class Renderer

Renderers are objects that handle drawing things such as textures or shapes A renderer can be obtained from a window, and could be used to draw on the window Renderers draw using buffers; when a renderer draws, it isn't visible to the screen until the present method is called While most of these functions are ported directly off of LibSDL2, most of them have been renamed into standard OOP convention Many SDL functions are now property methods (eg. SDL_SetRenderDrawColor => renderer.drawColor = ...) All functions defined in renderer are based off of SDL functions and SDL documentation can be viewed as well

class Renderer
  : ShapeDrawer ;

Constructors

NameDescription
this Makes an SDL renderer for a window
this Makes a renderer from an already existing SDL_Renderer

Properties

NameTypeDescription
clipRect[set] AxisAlignedBoundingBox!(int,2)Sets the clip area for the renderer Anything that is rendered outside of the clip area gets discarded
clipRect[get] AxisAlignedBoundingBox!(int,2)Gets the clip area for the renderer Anything that is rendered outside of the clip area gets discarded
drawBlendMode[set] derelict.sdl2.internal.sdl_types.SDL_BlendModeSets the renderer's draw blend mode that affects how the renderer draws
drawBlendMode[get] derelict.sdl2.internal.sdl_types.SDL_BlendModeGets the renderer's draw blend mode that affects how the renderer draws
drawColor[set] ColorSets the color of the renderer will draw with
drawColor[get] ColorReturns the color that the renderer will draw with
handle[get] derelict.sdl2.internal.sdl_types.SDL_Renderer*Returns the raw SDL data of this object
info[get] derelict.sdl2.internal.sdl_types.SDL_RendererInfoGets the renderer's information and returns it as an SDL_RendererInfo struct
logicalSize[set] Vector!(int,2)Sets the renderer's logical size Logical size works in that you only need to give coordinates for one specific resolution, and SDL will handle scaling that to the best resolution matching the logical size's aspect ratio
logicalSize[get] Vector!(int,2)Gets the renderer's logical size Logical size works in that you only need to give coordinates for one specific resolution, and SDL will handle scaling that to the best resolution matching the logical size's aspect ratio
outputSize[get] Vector!(int,2)Gets the renderer's output size
scale[set] Vector!(float,2)Sets the renderer's x and y scale to the given point's x and y values
scale[get] Vector!(float,2)Gets the renderer's x and y scale as a point with the scales as the x and y coordinates
viewport[set] AxisAlignedBoundingBox!(int,2)Sets the viewport of the renderer to the given rectangle
viewport[get] AxisAlignedBoundingBox!(int,2)Gets the viewport of the renderer as a rectangle

Methods

NameDescription
clear Fills the screen with the existing renderer color
copy Copies a texture to the window at the given point Uses the dimensions of the given sourceRect or if not given, the dimensions of the original texture
copy Copies a texture to the window at the given rectangle If sourceRect is null, it will copy the entire texture, otherwise, it will copy the slice defined by sourceRect
copy Copies a texture to the window at the given rectangle with the given angle If sourceRect is null, it will copy the entire texture, otherwise, it will copy the slice defined by sourceRect Angles are given in radians
drawPoint Draws a point Defines the fundamental draw for the shape drawer
present Updates what the renderer has drawn by actually outputting or presenting it
draw Draws a point to the screen Just calls the basic draw point method
draw Draws a point to the screen
draw Draws a point given by a vector
draw Draws a line given by two points
draw Draws a line given by a segment
draw Draws the given rectangle
draw Draws the given bezier curve with numPoints number of points on the curve More points is smoother but slower
draw Draws a polygon
draw Draws the ellipse bounded by the given box between the given angles in radians More points generally means a slower but more well drawn ellipse
drawLine Draws a line Can be overridden
drawPointRotated Draws a point rotated about the given "pointOfRotation" and rotated clockwise by the the amount of radians specified in "rotation"
drawRect Draws the outlines of a rectangle Can be overridden
drawRotated Performs a draw function but rotates each point by the specified rotation given in radians clockwise around the specified point
fill Fills the given rectangle
fill Fills a polygon Uses scanlining
fill Fills the ellipse bounded by the given box between the given angles in radians Fills the ellipse between the arc endpoints: fills ellipse as arc rather than filling as ellipse (not a pizza slice) More points generally means a slower but more well drawn ellipse
fillRect Fills in a rectangle Can be overridden