arc
Category: primitives
Draws an arc on the screen.
This function renders a circular arc segment to the active canvas.
The angles are measured in degrees, clockwise from the positive x-axis.
Parameters
-
cx
(number)
The x coordinate of the center point of the arc's circle.
-
cy
(number)
The y coordinate of the center point of the arc's circle.
-
radius
(number)
The radius of the arc's circle.
-
angle1
(number)
The starting angle in degrees.
-
angle2
(number)
The ending angle in degrees.
Returns
-
void
This function does not return a value.
Example
$.screen( "300x200" );
$.arc( 150, 100, 50, 45, 270 );bezier
Category: primitives
Draws a bezier curve on the screen.
This function renders a cubic Bezier curve to the active canvas.
A Bezier curve is defined by four control points: two endpoints and two control points that
influence the curve's shape.
Parameters
-
x1
(number)
The x coordinate of the first control point (starting point).
-
y1
(number)
The y coordinate of the first control point (starting point).
-
x2
(number)
The x coordinate of the second control point.
-
y2
(number)
The y coordinate of the second control point.
-
x3
(number)
The x coordinate of the third control point.
-
y3
(number)
The y coordinate of the third control point.
-
x4
(number)
The x coordinate of the fourth control point (ending point).
-
y4
(number)
The y coordinate of the fourth control point (ending point).
Returns
-
void
This function does not return a value.
Example
$.screen( "300x200" );
$.bezier( 15, 10, 45, 135, 195, 75, 280, 185 );circle
Category: primitives
Draws a circle on the screen.
This function renders a circle to the active canvas.
The circle is drawn with a border using the current foreground color. If a fill color is provided,
the circle will be filled with that color.
Parameters
-
x
(number)
The x coordinate of the center of the circle.
-
y
(number)
The y coordinate of the center of the circle.
-
radius
(number)
The radius of the circle.
-
fillColor
(string|number)
Optional
The fill color for the circle. Can be a color name, hex string, or palette index.
Returns
-
void
This function does not return a value.
Example
$.screen( "300x200" );
$.circle( 150, 100, 50, "red" );cls
Category: primitives
Clears the screen or a rectangular region.
This function clears the entire screen or a rectangular region of the active canvas.
When x, y, width, and height are provided, only that region is cleared. Otherwise the full screen is
cleared and the cursor is reset.
Parameters
-
x
(number)
Optional
The horizontal coordinate of the region to clear.
-
y
(number)
Optional
The vertical coordinate of the region to clear.
-
width
(number)
Optional
The width of the region to clear.
-
height
(number)
Optional
The height of the region to clear.
Returns
-
void
This function does not return a value.
Example
$.screen( "300x200" );
$.cls();
$.cls( 25, 25, 100, 50 );ellipse
Category: primitives
Draws an ellipse on the screen.
This function renders an ellipse to the active canvas.
The ellipse is drawn with a border using the current foreground color. If a fill color is provided,
the ellipse will be filled with that color.
Parameters
-
x
(number)
The x coordinate of the center of the ellipse.
-
y
(number)
The y coordinate of the center of the ellipse.
-
rx
(number)
The horizontal radius of the ellipse.
-
ry
(number)
The vertical radius of the ellipse.
-
fillColor
(string|number)
Optional
The fill color for the ellipse. Can be a color name, hex string, or palette index.
Returns
-
void
This function does not return a value.
Example
$.screen( "300x200" );
$.ellipse( 150, 100, 50, 80, "blue" );line
Category: primitives
Draws a line on the screen.
This function renders a line segment to the active canvas.
The line is drawn from the first point to the second point using the current foreground color.
Parameters
-
x1
(number)
The x coordinate of the starting point of the line.
-
y1
(number)
The y coordinate of the starting point of the line.
-
x2
(number)
The x coordinate of the ending point of the line.
-
y2
(number)
The y coordinate of the ending point of the line.
Returns
-
void
This function does not return a value.
Example
$.screen( "300x200" );
$.setColor( 4 );
$.line( 15, 15, 285, 185 );
$.setColor( 2 );
$.line( 15, 185, 285, 15 );pset
Category: primitives
Sets a pixel on the screen to the current foreground color.
This function sets a single pixel on the active canvas to the current foreground color.
After drawing, the cursor position is updated to the pixel coordinates.
Parameters
-
x
(number)
The x coordinate of the pixel to set.
-
y
(number)
The y coordinate of the pixel to set.
Returns
-
void
This function does not return a value.
Example
$.screen( "300x200" );
$.setColor( 2 );
$.pset( 148, 101 );
$.pset( 149, 100 );
$.pset( 150, 101 );
$.pset( 151, 100 );
$.pset( 152, 101 );rect
Category: primitives
Draws a rectangle on the screen.
This function renders a rectangle to the active canvas.
The rectangle is drawn with a border using the current foreground color. If a fill color is
provided, the rectangle will be filled with that color (the fill area is slightly inset from the
border).
Parameters
-
x
(number)
The x coordinate of the upper left corner of the rectangle.
-
y
(number)
The y coordinate of the upper left corner of the rectangle.
-
width
(number)
The width of the rectangle.
-
height
(number)
The height of the rectangle.
-
fillColor
(string|number)
Optional
The fill color for the rectangle. Can be a color name, hex string, or palette index.
Returns
-
void
This function does not return a value.
Example
$.screen( "300x200" );
$.setColor( 5 );
$.rect( 15, 15, 150, 100 );
$.rect( 25, 25, 150, 100, 6 );
$.rect( 35, 35, 150, 100, 2 );rect2
Category: primitives
Draws a rectangle on the screen.
This function renders a rectangle to the active canvas.
The rectangle is drawn with a border using the current foreground color. If a fill color is
provided, the rectangle will be filled with that color (the fill area is slightly inset from the
border).
This function is the same as rect except it will allow parameters to be passed as an object
literal for convience at a slight cost to performance.
Parameters
-
x
(number)
The x coordinate of the upper left corner of the rectangle.
-
y
(number)
The y coordinate of the upper left corner of the rectangle.
-
width
(number)
The width of the rectangle.
-
height
(number)
The height of the rectangle.
-
fillColor
(string|number)
Optional
The fill color for the rectangle. Can be a color name, hex string, or palette index.
Returns
-
void
This function does not return a value.
Example
const rectOptions = { "x": 25, "y": 25, "width": 150, "height": 100, "fillColor": 6 };
$.screen( "300x200" );
$.rect2( rectOptions );