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 {}

Constructors

this
this(Window window, uint flags = 0)

Makes an SDL renderer for a window

this
this(SDL_Renderer* alreadyExisting)

Makes a renderer from an already existing SDL_Renderer

Destructor

~this
~this()

Ensures that SDL can properly dispose of the renderer

Members

Functions

clear
void clear()

Fills the screen with the existing renderer color

clear
void clear(Color color)

Sets the renderer's color and clears the screen

copy
void copy(Texture texture, int x, int y, iRectangle sourceRect = null)

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
void copy(Texture texture, iRectangle destinationRect, iRectangle sourceRect = null)

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
void copy(Texture texture, iRectangle destinationRect, double angle, SDL_RendererFlip flip = SDL_FLIP_NONE, iVector center = null, iRectangle sourceRect = null)

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

draw
void draw(iVector first, iVector second)

Draws a line between the given points

draw
void draw(iVector first, iVector second, Color color)

Draws a line of a given color between the given points

draw
void draw(iSegment line)

Draws a line given a segment

draw
void draw(iSegment line, Color color)

Draws a line with a specific color

draw
void draw(int x, int y)

Draws a point

draw
void draw(iVector toDraw)

Draws a point

draw
void draw(iVector toDraw, Color color)

Draws a point in the given color

draw
void draw(iRectangle toDraw)

Draws a rectangle

draw
void draw(iRectangle toDraw, Color color)

Draws a rectangle with the given color

draw
void draw(BezierCurve!(int, 2) curve)

Draws the given bezier curve with numPoints number of points on the curve More points is smoother but slower

draw
void draw(BezierCurve!(int, 2) curve, Color color)

Draws the given bezier curve with the given color and amount of points on the curve More points is smoother but slower

draw
void draw(iPolygon!sides toDraw)

Draws a polygon

draw
void draw(iPolygon!sides toDraw, Color color)

Draws a polygon with the given color

draw
void draw(iRectangle bounds, double startAngle, double endAngle)

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

draw
void draw(iRectangle bounds, double startAngle, double endAngle, Color color)

Draws the ellipse bounded by the given box between the given angles in radians with the given color More points generally means a slower but more well drawn ellipse

fill
void fill(iRectangle toFill)

Fills a rectangle in

fill
void fill(iRectangle toFill, Color color)

Fills a rectangle in with the given color

fill
void fill(iRectangle bounds, double startAngle, double endAngle)

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

fill
void fill(iRectangle bounds, double startAngle, double endAngle, Color color)

Fills the ellipse bounded by the given box between the given angles in radians with the given color 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

fill
void fill(iPolygon!sides toDraw)

Fills a polygon Uses scanlining

fill
void fill(iPolygon!sides toDraw, Color color)

Fills a polygon with a given color

present
void present()

Updates what the renderer has drawn by actually outputting or presenting it

Properties

clipRect
iRectangle clipRect [@property setter]

Sets the clip area for the renderer Anything that is rendered outside of the clip area gets discarded

clipRect
iRectangle clipRect [@property getter]

Gets the clip area for the renderer Anything that is rendered outside of the clip area gets discarded

drawBlendMode
SDL_BlendMode drawBlendMode [@property setter]

Sets the renderer's draw blend mode that affects how the renderer draws

drawBlendMode
SDL_BlendMode drawBlendMode [@property getter]

Gets the renderer's draw blend mode that affects how the renderer draws

drawColor
Color drawColor [@property setter]

Sets the color of the renderer will draw with

drawColor
Color drawColor [@property getter]

Returns the color that the renderer will draw with

handle
SDL_Renderer* handle [@property getter]

Returns the raw SDL data of this object

info
SDL_RendererInfo info [@property getter]

Gets the renderer's information and returns it as an SDL_RendererInfo struct

logicalSize
iVector logicalSize [@property setter]

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
iVector logicalSize [@property getter]

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
iVector outputSize [@property getter]

Gets the renderer's output size

scale
fVector scale [@property setter]

Sets the renderer's x and y scale to the given point's x and y values

scale
fVector scale [@property getter]

Gets the renderer's x and y scale as a point with the scales as the x and y coordinates

viewport
iRectangle viewport [@property setter]

Sets the viewport of the renderer to the given rectangle

viewport
iRectangle viewport [@property getter]

Gets the viewport of the renderer as a rectangle

Meta