All Bundles
Renderer
Rendering state
Operations
New
Create a 2D rendering context for a window
New(window:Window, index:Int, flags:Int)
Parameters
Name | Type | Description |
---|
window | Window | window context |
index | Int | the index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags |
flags | Int | 0, or one or more SDL_RendererFlags OR'd together |
Return
Type | Description |
---|
@return_type | rendering context |
AACircleColor
Raw anti-aliased circle with blending.
method : public : AACircleColor(x:Int, y:Int, rad:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X coordinate of the center of the aa-circle. |
y | Int | Y coordinate of the center of the aa-circle. |
rad | Int | Radius in pixels of the aa-circle. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
AAEllipseColor
Draw ellipse with blending.
method : public : AAEllipseColor(x:Int, y:Int, rx:Int, ry:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X coordinate of the center of the ellipse. |
y | Int | Y coordinate of the center of the ellipse. |
rx | Int | Horizontal radius in pixels of the ellipse. |
ry | Int | Vertical radius in pixels of the ellipse. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
AALineColor
Draw anti-aliased line with alpha blending.
method : public : AALineColor(x1:Int, y1:Int, x2:Int, y2:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point of the aa-line. |
y1 | Int | Y coordinate of the first point of the aa-line. |
x2 | Int | X coordinate of the second point of the aa-line. |
y2 | Int | Y coordinate of the second point of the aa-line. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
AAPolygonColor
Draw anti-aliased polygon with alpha blending.
method : public : AAPolygonColor(vx:Int[], vy:Int[], color:Color) ~ Int
Parameters
Name | Type | Description |
---|
vx | Int[] | Vertex array containing X coordinates of the points of the polygon. |
vy | Int[] | Vertex array containing Y coordinates of the points of the polygon. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
AAtrigonColor
Draw anti-aliased trigon (triangle outline) with alpha blending. Note: Creates vertex array and uses aapolygon routine to render.
method : public : AAtrigonColor(x1:Int, y1:Int, x2:Int, y2:Int, x3:Int, y3:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point of the aa-trigon. |
y1 | Int | Y coordinate of the first point of the aa-trigon. |
x2 | Int | X coordinate of the second point of the aa-trigon. |
y2 | Int | Y coordinate of the second point of the aa-trigon. |
x3 | Int | X coordinate of the third point of the aa-trigon. |
y3 | Int | Y coordinate of the third point of the aa-trigon. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
ArcColor
Arc with blending.
method : public : ArcColor(x:Int, y:Int, rad:Int, start:Int, end:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X coordinate of the center of the arc. |
y | Int | Y coordinate of the center of the arc. |
rad | Int | Radius in pixels of the arc. |
start | Int | Starting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise. |
end | Int | Ending radius in degrees of the arc. 0 degrees is down, increasing counterclockwise. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
BoxColor
Draw box (filled rectangle) with blending
method : public : BoxColor(x1:Int, y1:Int, x2:Int, y2:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point (i.e. top right) of the box. |
y1 | Int | Y coordinate of the first point (i.e. top right) of the box. |
x2 | Int | X coordinate of the second point (i.e. bottom left) of the box. |
y2 | Int | Y coordinate of the second point (i.e. bottom left) of the box. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
CharacterColor
Draw a character of the currently set font.
method : public : CharacterColor(x:Int, y:Int, c:Char, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X (horizontal) coordinate of the upper left corner of the character. |
y | Int | Y (vertical) coordinate of the upper left corner of the character. |
c | Char | The character to draw. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
CircleColor
Draw circle with blending.
method : public : CircleColor(x:Int, y:Int, rad:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X coordinate of the center of the circle. |
y | Int | Y coordinate of the center of the circle. |
rad | Int | Radius in pixels of the circle. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
Clear
Clear the current rendering target with the drawing color
method : public : Clear() ~ Int
Copy
Copy a portion of the texture to the current rendering target
method : public : Copy(texture:Texture, srcrect:Rect, dstrect:Rect) ~ Int
Parameters
Name | Type | Description |
---|
texture | Texture | the source texture; see Remarks for details |
srcrect | Rect | the source SDL_Rect structure or Nil for the entire texture |
dstrect | Rect | the destination SDL_Rect structure or Nil for the entire rendering target; the texture will be stretched to fill the given rectangle |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
CopyEx
Copy a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right
method : public : CopyEx(texture:Texture, srcrect:Rect, dstrect:Rect, angle:Float, center:Point, flip:RendererFlip) ~ Int
Parameters
Name | Type | Description |
---|
texture | Texture | the source texture; see Remarks for details |
srcrect | Rect | the source SDL_Rect structure or Nil for the entire texture |
dstrect | Rect | the destination SDL_Rect structure or Nil for the entire rendering target |
angle | Float | an angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction |
center | Point | a holder to a point indicating the point around which dstrect will be rotated (if Nil, rotation will be done around dstrect.w/2, dstrect.h/2) |
flip | RendererFlip | a SDL_RendererFlip value stating which flipping actions should be performed on the texture |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
CreateSoftwareRenderer
Create a 2D software rendering context for a surface
function : CreateSoftwareRenderer(surface:Surface) ~ Renderer
Parameters
Name | Type | Description |
---|
surface | Surface | Surface representing the surface where rendering is done |
Return
Type | Description |
---|
Renderer | valid rendering context |
CreateTexture
Create a texture for a rendering context
method : public : CreateTexture(format:Int, access:Int, w:Int, h:Int) ~ Texture
Parameters
Name | Type | Description |
---|
format | Int | one of the enumerated values in PixelFormatEnum |
access | Int | one of the enumerated values in TextureAccess |
w | Int | the width of the texture in pixels |
h | Int | the height of the texture in pixels |
Return
Type | Description |
---|
Texture | created texture |
Destroy
Destroy the rendering context for a window and free associated textures
method : public : Destroy() ~ Nil
DrawLine
Draw a line on the current rendering target
method : public : DrawLine(x1:Int, y1:Int, x2:Int, y2:Int) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | the x coordinate of the start point |
y1 | Int | the y coordinate of the start point |
x2 | Int | the x coordinate of the end point |
y2 | Int | the y coordinate of the end point |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
DrawPoint
Draw a point on the current rendering target
method : public : DrawPoint(x:Int, y:Int) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | the x coordinate of the point |
y | Int | the y coordinate of the point |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
DrawRect
Draw a rectangle on the current rendering target
method : public : DrawRect(rect:Rect) ~ Int
Parameters
Name | Type | Description |
---|
rect | Rect | Rect representing the rectangle to draw, or Nil to outline the entire rendering target |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
EllipseColor
Draw ellipse with blending.
method : public : EllipseColor(x:Int, y:Int, rx:Int, ry:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X coordinate of the center of the ellipse. |
y | Int | Y coordinate of the center of the ellipse. |
rx | Int | Horizontal radius in pixels of the ellipse. |
ry | Int | Vertical radius in pixels of the ellipse. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
FillRect
Fill a rectangle on the current rendering target with the drawing color
method : public : FillRect(rect:Rect) ~ Int
Parameters
Name | Type | Description |
---|
rect | Rect | Rect representing the rectangle to fill, or NULL for the entire rendering target |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
FilledCircleColor
Draw filled circle with blending.
method : public : FilledCircleColor(x:Int, y:Int, r:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X coordinate of the center of the filled circle. |
y | Int | Y coordinate of the center of the filled circle. |
r | Int | Radius in pixels of the filled circle. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
FilledEllipseColor
Draw filled ellipse with blending.
method : public : FilledEllipseColor(x:Int, y:Int, rx:Int, ry:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X coordinate of the center of the filled ellipse. |
y | Int | Y coordinate of the center of the filled ellipse. |
rx | Int | Horizontal radius in pixels of the filled ellipse. |
ry | Int | Vertical radius in pixels of the filled ellipse. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
FilledPieColor
Draw filled pie with alpha blending.
method : public : FilledPieColor(x:Int, y:Int, rad:Int, start:Int, end:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X coordinate of the center of the filled pie. |
y | Int | Y coordinate of the center of the filled pie. |
rad | Int | Radius in pixels of the filled pie. |
start | Int | Starting radius in degrees of the filled pie. |
end | Int | Ending radius in degrees of the filled pie. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
FilledPolygonColor
Draw filled pie with alpha blending.
method : public : FilledPolygonColor(vx:Int[], vy:Int[], color:Color) ~ Int
Parameters
Name | Type | Description |
---|
vx | Int[] | Vertex array containing X coordinates of the points of the polygon. |
vy | Int[] | Vertex array containing Y coordinates of the points of the polygon. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
FilledTrigonColor
Draw filled trigon (triangle) with alpha blending. Note: Creates vertex array and uses aapolygon routine to render.
method : public : FilledTrigonColor(x1:Int, y1:Int, x2:Int, y2:Int, x3:Int, y3:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point of the filled trigon. |
y1 | Int | Y coordinate of the first point of the filled trigon. |
x2 | Int | X coordinate of the second point of the filled trigon. |
y2 | Int | Y coordinate of the second point of the filled trigon. |
x3 | Int | X coordinate of the third point of the filled trigon. |
y3 | Int | Y coordinate of the third point of the filled trigon. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
Get
Get the renderer associated with a window
function : Get(window:Window) ~ Renderer
Parameters
Name | Type | Description |
---|
window | Window | the window to query |
GetInfo
Get information about a rendering context
method : public : GetInfo(info:RendererInfo) ~ Int
Parameters
Name | Type | Description |
---|
info | RendererInfo | an RendererInfo filled with information about the current renderer |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
GetNumRenderDrivers
Get the number of 2D rendering drivers available for the current display
function : GetNumRenderDrivers() ~ Int
Return
Type | Description |
---|
Int | a number >= 0 on success or a negative error code on failure |
GetRenderDrawColor
Get the color used for drawing operations (Rect, Line and Clear)
method : public : GetRenderDrawColor(r:IntRef, g:IntRef, b:IntRef, a:IntRef) ~ Int
Parameters
Name | Type | Description |
---|
r | IntRef | pointer filled in with the red value used to draw on the rendering target |
g | IntRef | pointer filled in with the green value used to draw on the rendering target |
b | IntRef | pointer filled in with the blue value used to draw on the rendering target |
a | IntRef | holder filled in with the alpha value used to draw on the rendering target |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
GetRenderDriverInfo
Get information about a specific 2D rendering driver for the current display
function : GetRenderDriverInfo(index:Int, info:RendererInfo) ~ Int
Parameters
Name | Type | Description |
---|
index | Int | index of the driver to query information about |
info | RendererInfo | RendererInfo to be filled with information on the rendering driver |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
GetTarget
Get the current render target.
method : public : GetTarget() ~ Texture
Return
Type | Description |
---|
Texture | current target |
GetViewport
Get the drawing area for the current target
method : public : GetViewport(rect:Rect) ~ Nil
Parameters
Name | Type | Description |
---|
rect | Rect | Rect filled in with the current drawing area |
HLineColor
Draw horizontal line with blending
method : public : HLineColor(x1:Int, x2:Int, y:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point (i.e. left) of the line. |
x2 | Int | X coordinate of the second point (i.e. right) of the line. |
y | Int | Y coordinate of the points of the line. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
IsClipEnabled
Get whether clipping is enabled on the given renderer
method : public : IsClipEnabled() ~ Bool
Return
Type | Description |
---|
Bool | Returns true if clipping is enabled or false if not |
IsNull
Determines if the underlying SDL C-struct is NULL
method : public : IsNull() ~ Bool
Return
Type | Description |
---|
Bool | true if NULL, false otherwise |
LineColor
Draw line with alpha blending
method : public : LineColor(x1:Int, y1:Int, x2:Int, y2:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point of the line. |
y1 | Int | Y coordinate of the first point of the line. |
x2 | Int | X coordinate of the second point of the line. |
y2 | Int | Y coordinate of the seond point of the line. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
PieColor
Draw pie (outline) with alpha blending.
method : public : PieColor(x:Int, y:Int, rad:Int, start:Int, end:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X coordinate of the center of the pie. |
y | Int | Y coordinate of the center of the pie. |
rad | Int | Radius in pixels of the pie. |
start | Int | Starting radius in degrees of the pie. |
end | Int | Ending radius in degrees of the pie. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
PixelColor
Draw pixel with blending enabled if a<255.
method : public : PixelColor(x:Int, y:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | x-position |
y | Int | y-position |
color | Color | color |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
PolygonColor
Draw polygon with alpha blending.
method : public : PolygonColor(vx:Int[], vy:Int[], color:Color) ~ Int
Parameters
Name | Type | Description |
---|
vx | Int[] | Vertex array containing X coordinates of the points of the polygon. |
vy | Int[] | Vertex array containing Y coordinates of the points of the polygon. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
Present
Update the screen with any rendering performed since the previous call
method : public : Present() ~ Nil
RectangleColor
Draw rectangle with blending
method : public : RectangleColor(x1:Int, y1:Int, x2:Int, y2:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point (i.e. top right) of the rectangle. |
y1 | Int | Y coordinate of the first point (i.e. top right) of the rectangle. |
x2 | Int | X coordinate of the second point (i.e. bottom left) of the rectangle. |
y2 | Int | Y coordinate of the second point (i.e. bottom left) of the rectangle. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
RoundedBoxColor
Draw rounded-corner box (filled rectangle) with blending
method : public : RoundedBoxColor(x1:Int, y1:Int, x2:Int, y2:Int, rad:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point (i.e. top right) of the box. |
y1 | Int | Y coordinate of the first point (i.e. top right) of the box. |
x2 | Int | X coordinate of the second point (i.e. bottom left) of the box. |
y2 | Int | Y coordinate of the second point (i.e. bottom left) of the box. |
rad | Int | The radius of the corner arcs of the box. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
RoundedRectangleColor
Draw rounded-corner rectangle with blending
method : public : RoundedRectangleColor(x1:Int, y1:Int, x2:Int, y2:Int, rad:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point (i.e. top right) of the rectangle. |
y1 | Int | Y coordinate of the first point (i.e. top right) of the rectangle. |
x2 | Int | X coordinate of the second point (i.e. bottom left) of the rectangle. |
y2 | Int | Y coordinate of the second point (i.e. bottom left) of the rectangle. |
rad | Int | The radius of the corner arc. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
SetDrawColor
Set the color used for drawing operations (Rect, Line and Clear)
method : public : SetDrawColor(r:Int, g:Int, b:Int, a:Int) ~ Int
Parameters
Name | Type | Description |
---|
r | Int | the red value used to draw on the rendering target |
g | Int | the green value used to draw on the rendering target |
b | Int | the blue value used to draw on the rendering target |
a | Int | the alpha value used to draw on the rendering target |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
SetIntegerScale
Set whether to force integer scales for resolution-independent rendering
method : public : SetIntegerScale(enable:Bool) ~ Int
Parameters
Name | Type | Description |
---|
enable | Bool | enable or disable the integer scaling for rendering |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
SetTarget
Set a texture as the current rendering target.
method : public : SetTarget(texture:Texture) ~ Int
Parameters
Name | Type | Description |
---|
texture | Texture | the targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or Nil for the default render target |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
SetViewport
set the drawing area for rendering on the current target
method : public : SetViewport(rect:Rect) ~ Int
Parameters
Name | Type | Description |
---|
rect | Rect | Rect representing the drawing area, or Nil to set the viewport to the entire target |
Return
Type | Description |
---|
Int | 0 on success or a negative error code on failure |
StringColor
Draw a string in the currently set font.
method : public : StringColor(x:Int, y:Int, s:String, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X (horizontal) coordinate of the upper left corner of the string. |
y | Int | Y (vertical) coordinate of the upper left corner of the string. |
s | String | The string to draw. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
ThickLineColor
Draw a thick line with alpha blending.
method : public : ThickLineColor(x1:Int, y1:Int, x2:Int, y2:Int, width:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point of the line. |
y1 | Int | Y coordinate of the first point of the line. |
x2 | Int | X coordinate of the second point of the line. |
y2 | Int | Y coordinate of the second point of the line. |
width | Int | Width of the line in pixels. Must be >0. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
TrigonColor
Draw trigon (triangle outline) with alpha blending.
method : public : TrigonColor(x1:Int, y1:Int, x2:Int, y2:Int, x3:Int, y3:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x1 | Int | X coordinate of the first point of the trigon. |
y1 | Int | Y coordinate of the first point of the trigon. |
x2 | Int | X coordinate of the second point of the trigon. |
y2 | Int | Y coordinate of the second point of the trigon. |
x3 | Int | X coordinate of the third point of the trigon. |
y3 | Int | Y coordinate of the third point of the trigon. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |
VlineColor
Draw vertical line with blending
method : public : VlineColor(x:Int, y1:Int, y2:Int, color:Color) ~ Int
Parameters
Name | Type | Description |
---|
x | Int | X coordinate of the points of the line. |
y1 | Int | Y coordinate of the first point (i.e. top) of the line. |
y2 | Int | Y coordinate of the second point (i.e. bottom) of the line. |
color | Color | color value |
Return
Type | Description |
---|
Int | 0 on success, -1 on failure |