Static class with access to miscellanious drawing functions. These functions are not meant to replace Graphic components for Entities, but rather to help with testing and debugging. The primitives are drawn in screen space and do not utilize camera movement unless passed as x/y values.
Static variables
static alpha : Float
The alpha value to draw. Ranges between 0-1 where 0 is completely transparent and 1 is opaque.
The blending mode used by Draw functions. This will not apply to Draw.line(), but will apply to Draw.linePlus().
static lineThickness : Float
The line thickness to use when drawing lines. Defaults to a single pixel wide.
Static functions
static arc (x : Float, y : Float, radius : Float, start : Float, angle : Float, segments : Int = 25) : Void
Draws a circle to the screen.
Parameters:
x | X position of the circle's center. | |
y | Y position of the circle's center. | |
radius | Radius of the circle. | |
start | The starting angle in radians. | |
angle | The arc size in radians. | |
segments | Increasing will smooth the circle but takes longer to render. Must be a value greater than zero. |
static circle (x : Float, y : Float, radius : Float, segments : Int = 25, scaleX : Float = 1, scaleY : Float = 1) : Void
Draws a circle to the screen.
Parameters:
x | X position of the circle's center. | |
y | Y position of the circle's center. | |
radius | Radius of the circle. | |
segments | Increasing will smooth the circle but takes longer to render. Must be a value greater than zero. | |
scaleX | Scales the circle horizontally. | |
scaleY | Scales the circle vertically. |
static circleFilled (x : Float, y : Float, radius : Float, segments : Int = 25, scaleX : Float = 1, scaleY : Float = 1) : Void
Draws a circle to the screen.
Parameters:
x | X position of the circle's center. | |
y | Y position of the circle's center. | |
radius | Radius of the circle. | |
segments | Increasing will smooth the circle but takes longer to render. Must be a value greater than zero. | |
scaleX | Scales the circle horizontally. | |
scaleY | Scales the circle vertically. |
static curve (x1 : Int, y1 : Int, x2 : Int, y2 : Int, x3 : Int, y3 : Int, segments : Int = 25) : Void
Draws a quadratic curve.
Parameters:
x1 | X start. | |
y1 | Y start. | |
x2 | X control point, used to determine the curve. | |
y2 | Y control point, used to determine the curve. | |
x3 | X finish. | |
y3 | Y finish. | |
segments | Increasing will smooth the curve but takes longer to render. Must be a value greater than zero. |
static line (x1 : Float, y1 : Float, x2 : Float, y2 : Float) : Void
Draws a straight line.
Parameters:
x1 | Starting x position. | |
y1 | Starting y position. | |
x2 | Ending x position. | |
y2 | Ending y position. |
static polyline (points : Array<Float>, miterJoint : Bool = false) : Void
Draws a triangulated line polyline to the screen. This must be a closed loop of concave lines
Parameters:
points | An array of floats containing the points of the polyline. The array is ordered in x, y format and must have an even number of values. |
static rect (x : Float, y : Float, width : Float, height : Float) : Void
Draws a rectangle outline. Lines are drawn inside the width and height.
Parameters:
x | X position of the rectangle. | |
y | Y position of the rectangle. | |
width | Width of the rectangle. | |
height | Height of the rectangle. |
Available since:
2.5.2
static rectFilled (x : Float, y : Float, width : Float, height : Float) : Void
Draws a filled rectangle.
Parameters:
x | X position of the rectangle. | |
y | Y position of the rectangle. | |
width | Width of the rectangle. | |
height | Height of the rectangle. |
Available since:
4.0.0
static setColor (color : Color = 0xFFFFFF, alpha : Float = 1) : Void
Convenience function to set both color and alpha at the same time.