You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
radium/docs/api/draw.zpy

95 lines
1.8 KiB
Plaintext

# Engine.Draw
The Draw library provides functions to draw shapes, text, and sprites on a scene.
{TOC}
^ Engine.Draw.Line(**x1**, **y1**, **x2**, **y2**, **options**)
Draws a line.
x1::
The X coordinate of the starting position.
y1::
The Y coordinate of the starting position.
x2::
The X coordinate of the ending position.
y2::
The Y coordinate of the ending position.
options::
**Optional.** Options for drawing the line.
width::
Width of the line in pixels.
color::
The line {>../drawing}(color).
cap::
The type of {>../drawing}(line cap).
alpha::
The alpha value of the line.
@ Draw a blue line
$ Engine.Draw.Line(10, 10, 120, 120, {
color: "blue"
});
^ Engine.Draw.Rectangle(**x1**, **y1**, **x2**, **y2**, **options**)
Draws a rectangle.
x1::
The X coordinate of the top left corner.
y1::
The Y coordinate of the top left corner.
x2::
The X coordinate of the right bottom corner.
y2::
The Y coordinate of the right bottom corner.
options::
**Optional.** Options for drawing the rectangle.
width::
Width of the outline in pixels.
linecolor::
The {>../drawing}(color) of the outline.
cap::
The type {>../drawing}(line cap) for the outline.
rx::
The horizontal radius of the corners of the rectangle.
ry::
The vertical radius of the corners of the rectangle.
radius::
A short-hand option that sets both `rx` and `ry`.
color::
The fill color of the rectangle.
alpha::
The alpha value of the rectangle.
@ Draw a blue rectangle with a yellow outline, rounded borders and at 70% opacity
$ Engine.Draw.Rectangle(20, 30, 150, 180, {
linecolor: "yellow",
color: "blue",
radius: 8,
alpha: 0.7
});