Class Renderer
D class that wraps SDL_Renderer
managing a backend rendering instance
class Renderer
;
dsdl2
provides access to 2D draw commands, which accesses the internal backend renderer. The output/target
of the renderer can be displayed to a dsdl2
if desired, or be done in software to the RAM as a
dsdl2
.
Constructors
Name | Description |
---|---|
this
(sdlRenderer, isOwner, userRef)
|
Constructs a dsdl2 from a vanilla SDL_Renderer* from bindbc-sdl
|
this
(window, renderDriver, software, accelerated, presentVSync, targetTexture)
|
Creates a hardware dsdl2 that renders to a dsdl2 , which wraps SDL_CreateRenderer
|
this
(surface)
|
Creates a software dsdl2 that renders to a target surface, which wraps SDL_CreateSoftwareRenderer
|
Fields
Name | Type | Description |
---|---|---|
sdlRenderer
|
sdl | Internal SDL_Renderer pointer
|
Properties
Name | Type | Description |
---|---|---|
blendMode [get]
|
BlendMode | Wraps SDL_GetRenderDrawBlendMode which gets the color blending mode of the renderer
|
blendMode [set]
|
BlendMode | Wraps SDL_SetRenderDrawBlendMode which sets the color blending mode of the renderer
|
clipRect [get]
|
Rect | Wraps SDL_RenderGetClipRect which gets the clipping dsdl2 of the renderer
|
clipRect [set]
|
Rect | Wraps SDL_RenderSetClipRect which sets the clipping dsdl2 of the renderer
|
clipRect [set]
|
typeof(null) | Acts as SDL_RenderSetClipRect(renderer, NULL) which removes the clipping dsdl2 of the
renderer
|
clipRect [set]
|
std | Wraps SDL_RenderSetClipRect which sets or removes the clipping dsdl2 of the renderer
|
drawColor [get]
|
Color | Wraps SDL_GetRenderDrawColor which gets the draw color for the following draw calls
|
drawColor [set]
|
Color | Wraps SDL_SetRenderDrawColor which sets the draw color for the following draw calls
|
hasClipRect [get]
|
bool | Wraps SDL_RenderIsClipEnabled (from SDL 2.0.4) which checks whether a clipping rectangle is set in the
renderer
|
height [get]
|
uint | Wraps SDL_GetRendererOutputSize which gets the renderer output's height
|
info [get]
|
RendererInfo | Wraps SDL_GetRendererInfo which gets the renderer information
|
integerScaling [get]
|
bool | Wraps SDL_RenderGetIntegerScale (from SDL 2.0.5) which gets whether integer scales are forced
|
integerScaling [set]
|
bool | Wraps SDL_RenderSetIntegerScale (from SDL 2.0.5) which sets whether integer scales should be forced
|
logicalHeight [get]
|
uint | Wraps SDL_RenderGetLogicalSize which gets the renderer output's logical height
|
logicalHeight [set]
|
uint | Wraps 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]
|
uint | Wraps SDL_RenderGetLogicalSize which gets the renderer output's logical width
|
logicalWidth [set]
|
uint | Wraps 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]
|
float | Wraps SDL_RenderGetScale which gets the X drawing scale of the renderer target
|
scaleX [set]
|
float | Wraps SDL_RenderSetScale which sets the X drawing scale of the renderer target
|
scaleY [get]
|
float | Wraps SDL_RenderGetScale which gets the Y drawing scale of the renderer target
|
scaleY [set]
|
float | Wraps 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]
|
bool | Wraps 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]
|
Texture | Wraps SDL_SetRenderTarget which sets the renderer's target
|
viewport [get]
|
Rect | Wraps SDL_RenderGetViewport which gets the dsdl2 viewport of the renderer
|
viewport [set]
|
Rect | Wraps SDL_RenderSetViewport which sets the dsdl2 viewport of the dsdl2
|
viewport [set]
|
typeof(null) | Acts as SDL_RenderSetViewport(renderer, NULL) which removes the dsdl2 viewport of the
dsdl2
|
viewport [set]
|
std | Wraps SDL_RenderSetViewport which sets or removes the viewport dsdl2 of the dsdl2
|
width [get]
|
uint | Wraps 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 proxy to the window associated
with the renderer
|
Methods
Name | Description |
---|---|
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 from the renderer's entire target
|
readPixels
(rect, format)
|
Wraps SDL_RenderReadPixels which makes a dsdl2 from a specified dsdl2 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
|
toString
()
|
Formats the dsdl2 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);