Class Renderer

D class that wraps SDL_Renderer managing a backend rendering instance

class Renderer ;

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.

Constructors

NameDescription
this (sdlRenderer, isOwner, userRef) Constructs a dsdl2.Renderer from a vanilla SDL_Renderer* from bindbc-sdl
this (window, renderDriver, software, accelerated, presentVSync, targetTexture) Creates a hardware dsdl2.Renderer that renders to a dsdl2.Window, which wraps SDL_CreateRenderer
this (surface) Creates a software dsdl2.Renderer that renders to a target surface, which wraps SDL_CreateSoftwareRenderer

Fields

NameTypeDescription
sdlRenderer sdl.render.SDL_Renderer*Internal SDL_Renderer pointer

Properties

NameTypeDescription
blendMode[get] BlendModeWraps SDL_GetRenderDrawBlendMode which gets the color blending mode of the renderer
blendMode[set] BlendModeWraps SDL_SetRenderDrawBlendMode which sets the color blending mode of the renderer
clipRect[get] RectWraps SDL_RenderGetClipRect which gets the clipping dsdl2.Rect of the renderer
clipRect[set] RectWraps SDL_RenderSetClipRect which sets the clipping dsdl2.Rect of the renderer
clipRect[set] typeof(null)Acts as SDL_RenderSetClipRect(renderer, NULL) which removes the clipping dsdl2.Rect of the renderer
clipRect[set] std.typecons.Nullable!(dsdl2.rect.Rect)Wraps SDL_RenderSetClipRect which sets or removes the clipping dsdl2.Rect of the renderer
drawColor[get] ColorWraps SDL_GetRenderDrawColor which gets the draw color for the following draw calls
drawColor[set] ColorWraps SDL_SetRenderDrawColor which sets the draw color for the following draw calls
hasClipRect[get] boolWraps SDL_RenderIsClipEnabled (from SDL 2.0.4) which checks whether a clipping rectangle is set in the renderer
height[get] uintWraps SDL_GetRendererOutputSize which gets the renderer output's height
info[get] RendererInfoWraps SDL_GetRendererInfo which gets the renderer information
integerScaling[get] boolWraps SDL_RenderGetIntegerScale (from SDL 2.0.5) which gets whether integer scales are forced
integerScaling[set] boolWraps SDL_RenderSetIntegerScale (from SDL 2.0.5) which sets whether integer scales should be forced
logicalHeight[get] uintWraps SDL_RenderGetLogicalSize which gets the renderer output's logical height
logicalHeight[set] uintWraps SDL_RenderSetLogicalSize which sets the renderer output's logical height
logicalSize[get] uint[2]Wraps SDL_RenderGetLogicalSize which gets the renderer logical size
logicalSize[set] uint[2]Wraps SDL_RenderSetLogicalSize which sets the renderer output's logical size
logicalWidth[get] uintWraps SDL_RenderGetLogicalSize which gets the renderer output's logical width
logicalWidth[set] uintWraps SDL_RenderSetLogicalSize which sets the renderer output's logical width
scale[get] float[2]Wraps SDL_RenderGetScale which gets the drawing scale of the renderer target
scale[set] float[2]Wraps SDL_RenderSetScale which sets the drawing scale of the renderer target
scaleX[get] floatWraps SDL_RenderGetScale which gets the X drawing scale of the renderer target
scaleX[set] floatWraps SDL_RenderSetScale which sets the X drawing scale of the renderer target
scaleY[get] floatWraps SDL_RenderGetScale which gets the Y drawing scale of the renderer target
scaleY[set] floatWraps SDL_RenderSetScale which sets the Y drawing scale of the renderer target
size[get] uint[2]Wraps SDL_GetRendererOutputSize which gets the renderer output's size
supportsTarget[get] boolWraps SDL_RenderTargetSupported which checks if the renderer supports texture targets
target[get] inout(Texture)Wraps SDL_GetRenderTarget which gets the renderer's target
target[set] TextureWraps SDL_SetRenderTarget which sets the renderer's target
viewport[get] RectWraps SDL_RenderGetViewport which gets the dsdl2.Rect viewport of the renderer
viewport[set] RectWraps SDL_RenderSetViewport which sets the dsdl2.Rect viewport of the dsdl2.Renderer
viewport[set] typeof(null)Acts as SDL_RenderSetViewport(renderer, NULL) which removes the dsdl2.Rect viewport of the dsdl2.Renderer
viewport[set] std.typecons.Nullable!(dsdl2.rect.Rect)Wraps SDL_RenderSetViewport which sets or removes the viewport dsdl2.Rect of the dsdl2.Renderer
width[get] uintWraps SDL_GetRendererOutputSize which gets the renderer output's width
window[get] inout(Window)Wraps SDL_RenderGetWindow (from SDL 2.0.22) which gets a dsdl2.Window proxy to the window associated with the renderer

Methods

NameDescription
clear () Wraps SDL_RenderClear which clears the target with the renderer's draw color
copy (texture, destRect) Acts as SDL_RenderCopy(renderer, texture, NULL, destRect) which copies the entire texture to destRect at the renderer's target
copy (texture, destRect, srcRect) Wraps SDL_RenderCopy which copies a part of the texture at srcRect to destRect at the renderer's target
copy (texture, 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 (texture, destRect, 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 (texture, destRect, angle, flippedHorizontally, 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 (texture, destRect, angle, srcRect, flippedHorizontally, 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 (texture, destRect, angle, center, flippedHorizontally, 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 (texture, destRect, angle, srcRect, center, flippedHorizontally, flippedVertically) Wraps SDL_RenderCopyEx which copies the entire texture to destRect at the renderer's target with certain angle and flipping
copyEx (texture, destRect, angle, flippedHorizontally, 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 (texture, destRect, angle, srcRect, flippedHorizontally, 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 (texture, destRect, angle, center, flippedHorizontally, 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 (texture, destRect, angle, srcRect, center, flippedHorizontally, 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
drawLine (line) Wraps SDL_RenderDrawLine which draws a line between two points with the renderer's draw color
drawLine (line) Wraps SDL_RenderDrawLineF (from SDL 2.0.10) which draws a line between two points with the renderer's draw color
drawLines (points) Wraps SDL_RenderDrawLines which draws multiple lines following given points with the renderer's draw color
drawLines (points) Wraps SDL_RenderDrawLinesF (from SDL 2.0.10) which draws multiple lines following given points with the renderer's draw color
drawPoint (point) Wraps SDL_RenderDrawPoint which draws a single point at a given position with the renderer's draw color
drawPoint (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 (points) Wraps SDL_RenderDrawPoints which draws multiple points at given positions with the renderer's draw color
drawPoints (points) Wraps SDL_RenderDrawPointsF (from SDL 2.0.10) which draws multiple points at given positions with the renderer's draw color
drawRect (rect) Wraps SDL_RenderDrawRect which draws a rectangle's edges with the renderer's draw color
drawRect (rect) Wraps SDL_RenderDrawRectF (from SDL 2.0.10) which draws a rectangle's edges with the renderer's draw color
drawRects (rects) Wraps SDL_RenderDrawRects which draws multiple rectangles' edges with the renderer's draw color
drawRects (rects) Wraps SDL_RenderDrawRectsF (from SDL 2.0.10) which draws multiple rectangles' edges with the renderer's draw color
fillRect (rect) Wraps SDL_RenderFillRect which fills a rectangle with the renderer's draw color
fillRect (rect) Wraps SDL_RenderFillRectF (from SDL 2.0.10) which fills a rectangle with the renderer's draw color
fillRects (rects) Wraps SDL_RenderFillRects which fills multiple rectangles with the renderer's draw color
fillRects (rects) Wraps SDL_RenderFillRectsF (from SDL 2.0.10) which fills multiple rectangles with the renderer's draw color
flush () Wraps SDL_RenderFlush (from SDL 2.0.10) which executes and flushes all pending rendering operations
getMetalCommandEncoder () Wraps SDL_RenderGetMetalCommandEncoder (from SDL 2.0.8) which gets the Metal command encoder for the current frame
getMetalLayer () Wraps SDL_RenderGetMetalLayer (from SDL 2.0.8) which gets the CAMetalLayer pointer associated with the given Metal renderer
logicalToWindow (fxy) Wraps SDL_RenderLogicalToWindow (from SDL 2.0.18) which maps logical coordinates to window coordinates
opEquals (rhs) Equality operator overload
present () Wraps SDL_RenderPresent which presents any appending changes to the renderer's target
readPixels (format) Wraps SDL_RenderReadPixels which makes a dsdl2.Surface from the renderer's entire target
readPixels (rect, format) Wraps SDL_RenderReadPixels which makes a dsdl2.Surface from a specified dsdl2.Rect boundary at the renderer's target
renderGeometry (vertices, texture, indices) Wraps SDL_RenderGeometry (from SDL 2.0.18) which renders triangles to the renderer's target
setVSync (vSync) Wraps SDL_RenderSetVSync which sets whether vertical synchronization should be enabled
toHash () Gets the hash of the dsdl2.Renderer
toString () Formats the dsdl2.Renderer into its construction representation: "dsdl2.Renderer(<sdlRenderer>)"
windowToLogical (xy) Wraps SDL_RenderWindowToLogical (from SDL 2.0.18) which maps window coordinates to logical coordinates

Example

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);