v2026.11.0
All Bundles
Bundle

SDL2 multimedia library for 2D graphics, input handling, audio playback, and window management. Core types: Window, Renderer, Texture, Surface, Event, and Mixer. Compile with -lib sdl2.

Renderer

Rendering state

Operations

AACircleColor #

Raw anti-aliased circle with blending.

method : public : AACircleColor(x:Int, y:Int, rad:Int, color:Color) ~ Int

Parameters

NameTypeDescription
xIntX coordinate of the center of the aa-circle.
yIntY coordinate of the center of the aa-circle.
radIntRadius in pixels of the aa-circle.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
xIntX coordinate of the center of the ellipse.
yIntY coordinate of the center of the ellipse.
rxIntHorizontal radius in pixels of the ellipse.
ryIntVertical radius in pixels of the ellipse.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
x1IntX coordinate of the first point of the aa-line.
y1IntY coordinate of the first point of the aa-line.
x2IntX coordinate of the second point of the aa-line.
y2IntY coordinate of the second point of the aa-line.
colorColorcolor value

Return

TypeDescription
Int0 on success, -1 on failure

AAPolygonColor #

Draw anti-aliased polygon with alpha blending.

method : public : AAPolygonColor(vx:Int[], vy:Int[], color:Color) ~ Int

Parameters

NameTypeDescription
vxIntVertex array containing X coordinates of the points of the polygon.
vyIntVertex array containing Y coordinates of the points of the polygon.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
x1IntX coordinate of the first point of the aa-trigon.
y1IntY coordinate of the first point of the aa-trigon.
x2IntX coordinate of the second point of the aa-trigon.
y2IntY coordinate of the second point of the aa-trigon.
x3IntX coordinate of the third point of the aa-trigon.
y3IntY coordinate of the third point of the aa-trigon.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
xIntX coordinate of the center of the arc.
yIntY coordinate of the center of the arc.
radIntRadius in pixels of the arc.
startIntStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endIntEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
x1IntX coordinate of the first point (i.e. top right) of the box.
y1IntY coordinate of the first point (i.e. top right) of the box.
x2IntX coordinate of the second point (i.e. bottom left) of the box.
y2IntY coordinate of the second point (i.e. bottom left) of the box.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
xIntX (horizontal) coordinate of the upper left corner of the character.
yIntY (vertical) coordinate of the upper left corner of the character.
cCharThe character to draw.
colorColorcolor value

Return

TypeDescription
Int0 on success, -1 on failure

CircleColor #

Draw circle with blending.

method : public : CircleColor(x:Int, y:Int, rad:Int, color:Color) ~ Int

Parameters

NameTypeDescription
xIntX coordinate of the center of the circle.
yIntY coordinate of the center of the circle.
radIntRadius in pixels of the circle.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
textureTexturethe source texture; see Remarks for details
srcrectRectthe source SDL_Rect structure or Nil for the entire texture
dstrectRectthe destination SDL_Rect structure or Nil for the entire rendering target; the texture will be stretched to fill the given rectangle

Return

TypeDescription
Int0 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

NameTypeDescription
textureTexturethe source texture; see Remarks for details
srcrectRectthe source SDL_Rect structure or Nil for the entire texture
dstrectRectthe destination SDL_Rect structure or Nil for the entire rendering target
angleFloatan angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
centerPointa 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)
flipRendererFlipa SDL_RendererFlip value stating which flipping actions should be performed on the texture

Return

TypeDescription
Int0 on success or a negative error code on failure

CreateSoftwareRenderer # function

Create a 2D software rendering context for a surface

function : CreateSoftwareRenderer(surface:Surface) ~ Renderer

Parameters

NameTypeDescription
surfaceSurfaceSurface representing the surface where rendering is done

Return

TypeDescription
Renderervalid rendering context

CreateTexture #

Create a texture for a rendering context

method : public : CreateTexture(format:Int, access:Int, w:Int, h:Int) ~ Texture

Parameters

NameTypeDescription
formatIntone of the enumerated values in PixelFormatEnum
accessIntone of the enumerated values in TextureAccess
wIntthe width of the texture in pixels
hIntthe height of the texture in pixels

Return

TypeDescription
Texturecreated 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

NameTypeDescription
x1Intthe x coordinate of the start point
y1Intthe y coordinate of the start point
x2Intthe x coordinate of the end point
y2Intthe y coordinate of the end point

Return

TypeDescription
Int0 on success or a negative error code on failure

DrawLineF #

Draw a line at sub-pixel precision

method : public : DrawLineF(x1:Float, y1:Float, x2:Float, y2:Float) ~ Int

Parameters

NameTypeDescription
x1Floatthe x coordinate of the start point
y1Floatthe y coordinate of the start point
x2Floatthe x coordinate of the end point
y2Floatthe y coordinate of the end point

Return

TypeDescription
Int0 on success or a negative error code on failure

DrawLines #

Draw a connected series of line segments, a polyline, in one call

method : public : DrawLines(points:Int[]) ~ Int

Parameters

NameTypeDescription
pointsIntflat array of x,y pairs: x0, y0, x1, y1, ...; each point joins the next

Return

TypeDescription
Int0 on success, or a negative value on failure or when the array is empty or holds an odd count

Example

renderer->DrawLines([0, 100, 50, 20, 100, 60, 150, 10]);

DrawPoint #

Draw a point on the current rendering target

method : public : DrawPoint(x:Int, y:Int) ~ Int

Parameters

NameTypeDescription
xIntthe x coordinate of the point
yIntthe y coordinate of the point

Return

TypeDescription
Int0 on success or a negative error code on failure

DrawPointF #

Draw a point at sub-pixel precision

method : public : DrawPointF(x:Float, y:Float) ~ Int

Parameters

NameTypeDescription
xFloatthe x coordinate of the point
yFloatthe y coordinate of the point

Return

TypeDescription
Int0 on success or a negative error code on failure

DrawPoints #

Draw many points in one call

method : public : DrawPoints(points:Int[]) ~ Int

Parameters

NameTypeDescription
pointsIntflat array of x,y pairs: x0, y0, x1, y1, ...

Return

TypeDescription
Int0 on success, or a negative value on failure or when the array is empty or holds an odd count

Example

renderer->DrawPoints([10, 10, 20, 20, 30, 30]);

DrawRect #

Draw a rectangle on the current rendering target

method : public : DrawRect(rect:Rect) ~ Int

Parameters

NameTypeDescription
rectRectRect representing the rectangle to draw, or Nil to outline the entire rendering target

Return

TypeDescription
Int0 on success or a negative error code on failure

DrawRectF #

Draw a rectangle outline at sub-pixel precision

method : public : DrawRectF(x:Float, y:Float, w:Float, h:Float) ~ Int

Parameters

NameTypeDescription
xFloatthe x coordinate of the top left corner
yFloatthe y coordinate of the top left corner
wFloatthe width
hFloatthe height

Return

TypeDescription
Int0 on success or a negative error code on failure

DrawRects #

Draw the outlines of many rectangles in one call

method : public : DrawRects(rects:Int[]) ~ Int

Parameters

NameTypeDescription
rectsIntflat array of x,y,w,h quadruples

Return

TypeDescription
Int0 on success, or a negative value on failure or when the array is empty or not a multiple of 4

EllipseColor #

Draw ellipse with blending.

method : public : EllipseColor(x:Int, y:Int, rx:Int, ry:Int, color:Color) ~ Int

Parameters

NameTypeDescription
xIntX coordinate of the center of the ellipse.
yIntY coordinate of the center of the ellipse.
rxIntHorizontal radius in pixels of the ellipse.
ryIntVertical radius in pixels of the ellipse.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
rectRectRect representing the rectangle to fill, or NULL for the entire rendering target

Return

TypeDescription
Int0 on success or a negative error code on failure

FillRectF #

Fill a rectangle at sub-pixel precision

method : public : FillRectF(x:Float, y:Float, w:Float, h:Float) ~ Int

Parameters

NameTypeDescription
xFloatthe x coordinate of the top left corner
yFloatthe y coordinate of the top left corner
wFloatthe width
hFloatthe height

Return

TypeDescription
Int0 on success or a negative error code on failure

FillRects #

Fill many rectangles in one call, such as the bars of a chart

method : public : FillRects(rects:Int[]) ~ Int

Parameters

NameTypeDescription
rectsIntflat array of x,y,w,h quadruples

Return

TypeDescription
Int0 on success, or a negative value on failure or when the array is empty or not a multiple of 4

Example

renderer->FillRects([10, 50, 20, 100, 40, 80, 20, 70]);

FilledCircleColor #

Draw filled circle with blending.

method : public : FilledCircleColor(x:Int, y:Int, r:Int, color:Color) ~ Int

Parameters

NameTypeDescription
xIntX coordinate of the center of the filled circle.
yIntY coordinate of the center of the filled circle.
rIntRadius in pixels of the filled circle.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
xIntX coordinate of the center of the filled ellipse.
yIntY coordinate of the center of the filled ellipse.
rxIntHorizontal radius in pixels of the filled ellipse.
ryIntVertical radius in pixels of the filled ellipse.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
xIntX coordinate of the center of the filled pie.
yIntY coordinate of the center of the filled pie.
radIntRadius in pixels of the filled pie.
startIntStarting radius in degrees of the filled pie.
endIntEnding radius in degrees of the filled pie.
colorColorcolor value

Return

TypeDescription
Int0 on success, -1 on failure

FilledPolygonColor #

Draw filled pie with alpha blending.

method : public : FilledPolygonColor(vx:Int[], vy:Int[], color:Color) ~ Int

Parameters

NameTypeDescription
vxIntVertex array containing X coordinates of the points of the polygon.
vyIntVertex array containing Y coordinates of the points of the polygon.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
x1IntX coordinate of the first point of the filled trigon.
y1IntY coordinate of the first point of the filled trigon.
x2IntX coordinate of the second point of the filled trigon.
y2IntY coordinate of the second point of the filled trigon.
x3IntX coordinate of the third point of the filled trigon.
y3IntY coordinate of the third point of the filled trigon.
colorColorcolor value

Return

TypeDescription
Int0 on success, -1 on failure

Get # function

Get the renderer associated with a window

function : Get(window:Window) ~ Renderer

Parameters

NameTypeDescription
windowWindowthe window to query

GetDrawBlendMode #

Get the blend mode used for drawing operations

method : public : GetDrawBlendMode(blendMode:IntRef) ~ Int

Parameters

NameTypeDescription
blendModeIntRefholder filled in with the current BlendMode

Return

TypeDescription
Int0 on success or a negative error code on failure

GetInfo #

Get information about a rendering context

method : public : GetInfo(info:RendererInfo) ~ Int

Parameters

NameTypeDescription
infoRendererInfoan RendererInfo filled with information about the current renderer

Return

TypeDescription
Int0 on success or a negative error code on failure

GetLogicalSize #

Get the device independent resolution for rendering

method : public : GetLogicalSize(w:IntRef, h:IntRef) ~ Nil

Parameters

NameTypeDescription
wIntRefholder filled in with the logical width, 0 if none is set
hIntRefholder filled in with the logical height, 0 if none is set

GetNumRenderDrivers # function

Get the number of 2D rendering drivers available for the current display

function : GetNumRenderDrivers() ~ Int

Return

TypeDescription
Inta number >= 0 on success or a negative error code on failure

GetOutputSize #

Get the output size in pixels of the rendering target: the window, the surface of a software renderer, or the texture set with SetTarget

method : public : GetOutputSize(w:IntRef, h:IntRef) ~ Int

Parameters

NameTypeDescription
wIntRefholder filled in with the width in pixels
hIntRefholder filled in with the height in pixels

Return

TypeDescription
Int0 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

NameTypeDescription
rIntRefpointer filled in with the red value used to draw on the rendering target
gIntRefpointer filled in with the green value used to draw on the rendering target
bIntRefpointer filled in with the blue value used to draw on the rendering target
aIntRefholder filled in with the alpha value used to draw on the rendering target

Return

TypeDescription
Int0 on success or a negative error code on failure

GetRenderDriverInfo # function

Get information about a specific 2D rendering driver for the current display

function : GetRenderDriverInfo(index:Int, info:RendererInfo) ~ Int

Parameters

NameTypeDescription
indexIntindex of the driver to query information about
infoRendererInfoRendererInfo to be filled with information on the rendering driver

Return

TypeDescription
Int0 on success or a negative error code on failure

GetScale #

Get the drawing scale

method : public : GetScale(scale_x:FloatRef, scale_y:FloatRef) ~ Nil

Parameters

NameTypeDescription
scale_xFloatRefholder filled in with the horizontal scaling factor
scale_yFloatRefholder filled in with the vertical scaling factor

GetTarget #

Get the current render target.

method : public : GetTarget() ~ Texture

Return

TypeDescription
Texturecurrent target

GetViewport #

Get the drawing area for the current target

method : public : GetViewport(rect:Rect) ~ Nil

Parameters

NameTypeDescription
rectRectRect 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

NameTypeDescription
x1IntX coordinate of the first point (i.e. left) of the line.
x2IntX coordinate of the second point (i.e. right) of the line.
yIntY coordinate of the points of the line.
colorColorcolor value

Return

TypeDescription
Int0 on success, -1 on failure

IsClipEnabled #

Get whether clipping is enabled on the given renderer

method : public : IsClipEnabled() ~ Bool

Return

TypeDescription
BoolReturns true if clipping is enabled or false if not

IsNull #

Determines if the underlying SDL C-struct is NULL

method : public : IsNull() ~ Bool

Return

TypeDescription
Booltrue 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

NameTypeDescription
x1IntX coordinate of the first point of the line.
y1IntY coordinate of the first point of the line.
x2IntX coordinate of the second point of the line.
y2IntY coordinate of the seond point of the line.
colorColorcolor value

Return

TypeDescription
Int0 on success, -1 on failure

New # constructor

Create a 2D rendering context for a window

New(window:Window, index:Int, flags:Int)

Parameters

NameTypeDescription
windowWindowwindow context
indexIntthe index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags
flagsInt0, or one or more SDL_RendererFlags OR'd together

PieColor #

Draw pie (outline) with alpha blending.

method : public : PieColor(x:Int, y:Int, rad:Int, start:Int, end:Int, color:Color) ~ Int

Parameters

NameTypeDescription
xIntX coordinate of the center of the pie.
yIntY coordinate of the center of the pie.
radIntRadius in pixels of the pie.
startIntStarting radius in degrees of the pie.
endIntEnding radius in degrees of the pie.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
xIntx-position
yInty-position
colorColorcolor

Return

TypeDescription
Int0 on success, -1 on failure

PolygonColor #

Draw polygon with alpha blending.

method : public : PolygonColor(vx:Int[], vy:Int[], color:Color) ~ Int

Parameters

NameTypeDescription
vxIntVertex array containing X coordinates of the points of the polygon.
vyIntVertex array containing Y coordinates of the points of the polygon.
colorColorcolor value

Return

TypeDescription
Int0 on success, -1 on failure

Present #

Update the screen with any rendering performed since the previous call

method : public : Present() ~ Nil

ReadPixels #

Read the rendering target's pixels back into a new surface, for a screenshot or an exported figure. Call it after drawing and before Present, since the back buffer is undefined after presenting. Slow; not for every frame.

method : public : ReadPixels(rect:Rect) ~ Surface

Parameters

NameTypeDescription
rectRectthe area to read, or Nil for the whole target

Return

TypeDescription
Surfacea new 32-bit ARGB surface the caller must Free; IsNull() is true on failure

RectangleColor #

Draw rectangle with blending

method : public : RectangleColor(x1:Int, y1:Int, x2:Int, y2:Int, color:Color) ~ Int

Parameters

NameTypeDescription
x1IntX coordinate of the first point (i.e. from left) of the rectangle.
y1IntY coordinate of the first point (i.e. from top) of the rectangle.
x2IntX coordinate of the second point (i.e. from left) of the rectangle.
y2IntY coordinate of the second point (i.e. from top) of the rectangle.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
x1IntX coordinate of the first point (i.e. top right) of the box.
y1IntY coordinate of the first point (i.e. top right) of the box.
x2IntX coordinate of the second point (i.e. bottom left) of the box.
y2IntY coordinate of the second point (i.e. bottom left) of the box.
radIntThe radius of the corner arcs of the box.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
x1IntX coordinate of the first point (i.e. top right) of the rectangle.
y1IntY coordinate of the first point (i.e. top right) of the rectangle.
x2IntX coordinate of the second point (i.e. bottom left) of the rectangle.
y2IntY coordinate of the second point (i.e. bottom left) of the rectangle.
radIntThe radius of the corner arc.
colorColorcolor value

Return

TypeDescription
Int0 on success, -1 on failure

SavePNG #

Save the whole rendering target as a PNG file: ReadPixels followed by Image->SavePNG. Call it after drawing and before Present.

method : public : SavePNG(file:String) ~ Bool

Parameters

NameTypeDescription
fileStringfile path to write

Return

TypeDescription
Booltrue if the file was written

Example

renderer->Clear();
DrawChart(renderer);
renderer->SavePNG("figure1.png");
renderer->Present();

SetDrawBlendMode #

Set the blend mode used for drawing operations (Fill and Line). BlendMode->SDL_BLENDMODE_BLEND makes the alpha of SetDrawColor take effect.

method : public : SetDrawBlendMode(blendMode:BlendMode) ~ Int

Parameters

NameTypeDescription
blendModeBlendModethe BlendMode to use for blending

Return

TypeDescription
Int0 on success or a negative error code on failure

Example

renderer->SetDrawBlendMode(BlendMode->SDL_BLENDMODE_BLEND);
renderer->SetDrawColor(255, 0, 0, 128);
renderer->FillRect(Rect->New(10, 10, 100, 100));

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

NameTypeDescription
rIntthe red value used to draw on the rendering target
gIntthe green value used to draw on the rendering target
bIntthe blue value used to draw on the rendering target
aIntthe alpha value used to draw on the rendering target

Return

TypeDescription
Int0 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

NameTypeDescription
enableBoolenable or disable the integer scaling for rendering

Return

TypeDescription
Int0 on success or a negative error code on failure

SetLogicalSize #

Set a device independent resolution for rendering. Drawing is then in these logical coordinates, scaled to the output and letterboxed to keep the aspect ratio.

method : public : SetLogicalSize(w:Int, h:Int) ~ Int

Parameters

NameTypeDescription
wIntthe width of the logical resolution
hIntthe height of the logical resolution

Return

TypeDescription
Int0 on success or a negative error code on failure

Example

renderer->SetLogicalSize(320, 240);
renderer->FillRect(Rect->New(0, 0, 160, 120)); # the top-left quarter at any window size

SetScale #

Set the drawing scale; coordinates are multiplied by it before they reach the target

method : public : SetScale(scale_x:Float, scale_y:Float) ~ Int

Parameters

NameTypeDescription
scale_xFloatthe horizontal scaling factor
scale_yFloatthe vertical scaling factor

Return

TypeDescription
Int0 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

NameTypeDescription
textureTexturethe targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or Nil for the default render target

Return

TypeDescription
Int0 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

NameTypeDescription
rectRectRect representing the drawing area, or Nil to set the viewport to the entire target

Return

TypeDescription
Int0 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

NameTypeDescription
xIntX (horizontal) coordinate of the upper left corner of the string.
yIntY (vertical) coordinate of the upper left corner of the string.
sStringThe string to draw.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
x1IntX coordinate of the first point of the line.
y1IntY coordinate of the first point of the line.
x2IntX coordinate of the second point of the line.
y2IntY coordinate of the second point of the line.
widthIntWidth of the line in pixels. Must be >0.
colorColorcolor value

Return

TypeDescription
Int0 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

NameTypeDescription
x1IntX coordinate of the first point of the trigon.
y1IntY coordinate of the first point of the trigon.
x2IntX coordinate of the second point of the trigon.
y2IntY coordinate of the second point of the trigon.
x3IntX coordinate of the third point of the trigon.
y3IntY coordinate of the third point of the trigon.
colorColorcolor value

Return

TypeDescription
Int0 on success, -1 on failure

VlineColor #

Draw vertical line with blending

method : public : VlineColor(x:Int, y1:Int, y2:Int, color:Color) ~ Int

Parameters

NameTypeDescription
xIntX coordinate of the points of the line.
y1IntY coordinate of the first point (i.e. top) of the line.
y2IntY coordinate of the second point (i.e. bottom) of the line.
colorColorcolor value

Return

TypeDescription
Int0 on success, -1 on failure