Renderer

D class that wraps SDL_Renderer managing a backend rendering instance

dsdl2.Renderer provides access to 2D draw commands, which accesses the internal backend renderer. The output/target of the renderer can be displayed to a dsdl2.Window if desired, or be done in software to the RAM as a dsdl2.Surface.

@safe final
class Renderer {}

Constructors

this
this(SDL_Renderer* sdlRenderer, bool isOwner, void* userRef)

Constructs a dsdl2.Renderer from a vanilla SDL_Renderer* from bindbc-sdl

this
this(Window window, RenderDriver renderDriver, bool software, bool accelerated, bool presentVSync, bool targetTexture)

Creates a hardware dsdl2.Renderer that renders to a dsdl2.Window, which wraps SDL_CreateRenderer

this
this(Surface surface)

Creates a software dsdl2.Renderer that renders to a target surface, which wraps SDL_CreateSoftwareRenderer

Destructor

~this
~this()
Undocumented in source.

Members

Functions

blendMode
BlendMode blendMode()

Wraps SDL_GetRenderDrawBlendMode which gets the color blending mode of the renderer

blendMode
void blendMode(BlendMode newMode)

Wraps SDL_SetRenderDrawBlendMode which sets the color blending mode of the renderer

clear
void clear()

Wraps SDL_RenderClear which clears the target with the renderer's draw color

clipRect
Rect clipRect()

Wraps SDL_RenderGetClipRect which gets the clipping dsdl2.Rect of the renderer

clipRect
void clipRect(Rect newRect)

Wraps SDL_RenderSetClipRect which sets the clipping dsdl2.Rect of the renderer

clipRect
void clipRect(typeof(null) _)

Acts as SDL_RenderSetClipRect(renderer, NULL) which removes the clipping dsdl2.Rect of the renderer

clipRect
void clipRect(Nullable!Rect newRect)

Wraps SDL_RenderSetClipRect which sets or removes the clipping dsdl2.Rect of the renderer

copy
void copy(Texture texture, Rect destRect)

Acts as SDL_RenderCopy(renderer, texture, NULL, destRect) which copies the entire texture to destRect at the renderer's target

copy
void copy(Texture texture, Rect destRect, Rect srcRect)

Wraps SDL_RenderCopy which copies a part of the texture at srcRect to destRect at the renderer's target

copy
void copy(Texture texture, FRect destRect)

Acts as SDL_RenderCopyF(renderer, texture, NULL, destRect) (from SDL 2.0.10) which copies the entire texture to destRect at the renderer's target

copy
void copy(Texture texture, FRect destRect, Rect srcRect)

Wraps SDL_RenderCopyF (from SDL 2.0.10) which copies a part of the texture at srcRect to destRect at the renderer's target

copyEx
void copyEx(Texture texture, Rect destRect, double angle, bool flippedHorizontally, bool flippedVertically)

Acts as SDL_RenderCopyEx(renderer, texture, NULL, destRect, angle, NULL, flip) which copies the entire texture to destRect at the renderer's target with certain angle and flipping

copyEx
void copyEx(Texture texture, Rect destRect, double angle, Rect srcRect, bool flippedHorizontally, bool flippedVertically)

Acts as SDL_RenderCopyEx(renderer, texture, srcRect, destRect, angle, NULL, flip) which copies the entire texture to destRect at the renderer's target with certain angle and flipping

copyEx
void copyEx(Texture texture, Rect destRect, double angle, Point center, bool flippedHorizontally, bool flippedVertically)

Acts as SDL_RenderCopyEx(renderer, texture, NULL, destRect, angle, center, flip) which copies the entire texture to destRect at the renderer's target with certain angle and flipping

copyEx
void copyEx(Texture texture, Rect destRect, double angle, Rect srcRect, Point center, bool flippedHorizontally, bool flippedVertically)

Wraps SDL_RenderCopyEx which copies the entire texture to destRect at the renderer's target with certain angle and flipping

copyEx
void copyEx(Texture texture, FRect destRect, double angle, bool flippedHorizontally, bool flippedVertically)

Acts as SDL_RenderCopyExF(renderer, texture, NULL, destRect, angle, NULL, flip) (from SDL 2.0.10) which copies the entire texture to destRect at the renderer's target with certain angle and flipping

copyEx
void copyEx(Texture texture, FRect destRect, double angle, Rect srcRect, bool flippedHorizontally, bool flippedVertically)

Acts as SDL_RenderCopyExF(renderer, texture, srcRect, destRect, angle, NULL, flip) (from SDL 2.0.10) which copies the entire texture to destRect at the renderer's target with certain angle and flipping

copyEx
void copyEx(Texture texture, FRect destRect, double angle, FPoint center, bool flippedHorizontally, bool flippedVertically)

Acts as SDL_RenderCopyExF(renderer, texture, NULL, destRect, angle, center, flip) (from SDL 2.0.10) which copies the entire texture to destRect at the renderer's target with certain angle and flipping

copyEx
void copyEx(Texture texture, FRect destRect, double angle, Rect srcRect, FPoint center, bool flippedHorizontally, bool flippedVertically)

Wraps SDL_RenderCopyExF (from SDL 2.0.10) which copies the entire texture to destRect at the renderer's target with certain angle and flipping

drawColor
Color drawColor()

Wraps SDL_GetRenderDrawColor which gets the draw color for the following draw calls

drawColor
void drawColor(Color newColor)

Wraps SDL_SetRenderDrawColor which sets the draw color for the following draw calls

drawLine
void drawLine(Point[2] line)

Wraps SDL_RenderDrawLine which draws a line between two points with the renderer's draw color

drawLine
void drawLine(FPoint[2] line)

Wraps SDL_RenderDrawLineF (from SDL 2.0.10) which draws a line between two points with the renderer's draw color

drawLines
void drawLines(Point[] points)

Wraps SDL_RenderDrawLines which draws multiple lines following given points with the renderer's draw color

drawLines
void drawLines(FPoint[] points)

Wraps SDL_RenderDrawLinesF (from SDL 2.0.10) which draws multiple lines following given points with the renderer's draw color

drawPoint
void drawPoint(Point point)

Wraps SDL_RenderDrawPoint which draws a single point at a given position with the renderer's draw color

drawPoint
void drawPoint(FPoint point)

Wraps SDL_RenderDrawPointF (from SDL 2.0.10) which draws a single point at a given position with the renderer's draw color

drawPoints
void drawPoints(Point[] points)

Wraps SDL_RenderDrawPoints which draws multiple points at given positions with the renderer's draw color

drawPoints
void drawPoints(FPoint[] points)

Wraps SDL_RenderDrawPointsF (from SDL 2.0.10) which draws multiple points at given positions with the renderer's draw color

drawRect
void drawRect(Rect rect)

Wraps SDL_RenderDrawRect which draws a rectangle's edges with the renderer's draw color

drawRect
void drawRect(FRect rect)

Wraps SDL_RenderDrawRectF (from SDL 2.0.10) which draws a rectangle's edges with the renderer's draw color

drawRects
void drawRects(Rect[] rects)

Wraps SDL_RenderDrawRects which draws multiple rectangles' edges with the renderer's draw color

drawRects
void drawRects(FRect[] rects)

Wraps SDL_RenderDrawRectsF (from SDL 2.0.10) which draws multiple rectangles' edges with the renderer's draw color

fillRect
void fillRect(Rect rect)

Wraps SDL_RenderFillRect which fills a rectangle with the renderer's draw color

fillRect
void fillRect(FRect rect)

Wraps SDL_RenderFillRectF (from SDL 2.0.10) which fills a rectangle with the renderer's draw color

fillRects
void fillRects(Rect[] rects)

Wraps SDL_RenderFillRects which fills multiple rectangles with the renderer's draw color

fillRects
void fillRects(FRect[] rects)

Wraps SDL_RenderFillRectsF (from SDL 2.0.10) which fills multiple rectangles with the renderer's draw color

flush
void flush()

Wraps SDL_RenderFlush (from SDL 2.0.10) which executes and flushes all pending rendering operations

getMetalCommandEncoder
void* getMetalCommandEncoder()

Wraps SDL_RenderGetMetalCommandEncoder (from SDL 2.0.8) which gets the Metal command encoder for the current frame

getMetalLayer
void* getMetalLayer()

Wraps SDL_RenderGetMetalLayer (from SDL 2.0.8) which gets the CAMetalLayer pointer associated with the given Metal renderer

hasClipRect
bool hasClipRect()

Wraps SDL_RenderIsClipEnabled (from SDL 2.0.4) which checks whether a clipping rectangle is set in the renderer

height
uint height()

Wraps SDL_GetRendererOutputSize which gets the renderer output's height

info
RendererInfo info()

Wraps SDL_GetRendererInfo which gets the renderer information

integerScaling
bool integerScaling()

Wraps SDL_RenderGetIntegerScale (from SDL 2.0.5) which gets whether integer scales are forced

integerScaling
void integerScaling(bool newScale)

Wraps SDL_RenderSetIntegerScale (from SDL 2.0.5) which sets whether integer scales should be forced

logicalHeight
uint logicalHeight()

Wraps SDL_RenderGetLogicalSize which gets the renderer output's logical height

logicalHeight
void logicalHeight(uint newHeight)

Wraps SDL_RenderSetLogicalSize which sets the renderer output's logical height

logicalSize
uint[2] logicalSize()

Wraps SDL_RenderGetLogicalSize which gets the renderer logical size

logicalSize
void logicalSize(uint[2] newSize)

Wraps SDL_RenderSetLogicalSize which sets the renderer output's logical size

logicalToWindow
int[2] logicalToWindow(float[2] fxy)

Wraps SDL_RenderLogicalToWindow (from SDL 2.0.18) which maps logical coordinates to window coordinates

logicalWidth
uint logicalWidth()

Wraps SDL_RenderGetLogicalSize which gets the renderer output's logical width

logicalWidth
void logicalWidth(uint newWidth)

Wraps SDL_RenderSetLogicalSize which sets the renderer output's logical width

opEquals
bool opEquals(Renderer rhs)

Equality operator overload

present
void present()

Wraps SDL_RenderPresent which presents any appending changes to the renderer's target

readPixels
Surface readPixels(PixelFormat format)

Wraps SDL_RenderReadPixels which makes a dsdl2.Surface from the renderer's entire target

readPixels
Surface readPixels(Rect rect, PixelFormat format)

Wraps SDL_RenderReadPixels which makes a dsdl2.Surface from a specified dsdl2.Rect boundary at the renderer's target

renderGeometry
void renderGeometry(Vertex[] vertices, Texture texture, uint[] indices)

Wraps SDL_RenderGeometry (from SDL 2.0.18) which renders triangles to the renderer's target

scale
float[2] scale()

Wraps SDL_RenderGetScale which gets the drawing scale of the renderer target

scale
void scale(float[2] newScale)

Wraps SDL_RenderSetScale which sets the drawing scale of the renderer target

scaleX
float scaleX()

Wraps SDL_RenderGetScale which gets the X drawing scale of the renderer target

scaleX
void scaleX(float newX)

Wraps SDL_RenderSetScale which sets the X drawing scale of the renderer target

scaleY
float scaleY()

Wraps SDL_RenderGetScale which gets the Y drawing scale of the renderer target

scaleY
void scaleY(float newY)

Wraps SDL_RenderSetScale which sets the Y drawing scale of the renderer target

setVSync
void setVSync(bool vSync)

Wraps SDL_RenderSetVSync which sets whether vertical synchronization should be enabled

size
uint[2] size()

Wraps SDL_GetRendererOutputSize which gets the renderer output's size

supportsTarget
bool supportsTarget()

Wraps SDL_RenderTargetSupported which checks if the renderer supports texture targets

target
inout(Texture) target()

Wraps SDL_GetRenderTarget which gets the renderer's target

target
void target(Texture newTarget)

Wraps SDL_SetRenderTarget which sets the renderer's target

toHash
hash_t toHash()

Gets the hash of the dsdl2.Renderer

toString
string toString()

Formats the dsdl2.Renderer into its construction representation: "dsdl2.Renderer(<sdlRenderer>)"

viewport
Rect viewport()

Wraps SDL_RenderGetViewport which gets the dsdl2.Rect viewport of the renderer

viewport
void viewport(Rect newViewport)

Wraps SDL_RenderSetViewport which sets the dsdl2.Rect viewport of the dsdl2.Renderer

viewport
void viewport(typeof(null) _)

Acts as SDL_RenderSetViewport(renderer, NULL) which removes the dsdl2.Rect viewport of the dsdl2.Renderer

viewport
void viewport(Nullable!Rect newViewport)

Wraps SDL_RenderSetViewport which sets or removes the viewport dsdl2.Rect of the dsdl2.Renderer

width
uint width()

Wraps SDL_GetRendererOutputSize which gets the renderer output's width

window
inout(Window) window()

Wraps SDL_RenderGetWindow (from SDL 2.0.22) which gets a dsdl2.Window proxy to the window associated with the renderer

windowToLogical
float[2] windowToLogical(int[2] xy)

Wraps SDL_RenderWindowToLogical (from SDL 2.0.18) which maps window coordinates to logical coordinates

Variables

sdlRenderer
SDL_Renderer* sdlRenderer;

Internal SDL_Renderer pointer

Examples

auto window = new dsdl2.Window("My Window", [dsdl2.WindowPos.centered, dsdl2.WindowPos.centered], [800, 600]);
auto renderer = new dsdl2.Renderer(window, accelerated : true, acceleratedVSync : true);

Meta