OVERLAY

2D overlay rendering.

Availability: Client-only

Methods


OVERLAY.arc

client

Add a circular arc to the current path

Signature: action(num, num, num, num, num, bool)

Parameters:

NameTypeDescription
xnumCenter X position
ynumCenter Y position
radiusnumArc radius
startAnglenumStart angle in radians
endAnglenumEnd angle in radians
counterClockwiseboolDraw counter-clockwise
GAME.OVERLAY.arc(0, 10, 0, 0, 0, true);

OVERLAY.arcTo

client

Add an arc connecting two points with tangent lines

Signature: action(num, num, num, num, num)

Parameters:

NameTypeDescription
x1numFirst control point X
y1numFirst control point Y
x2numSecond control point X
y2numSecond control point Y
radiusnumArc radius
GAME.OVERLAY.arcTo(0, 10, 0, 10, 0);

OVERLAY.beginPath

client

Begin a new drawing path

Signature: action()

GAME.OVERLAY.beginPath();

OVERLAY.bezierCurveTo

client

Add a cubic bezier curve to the path

Signature: action(num, num, num, num, num, num)

Parameters:

NameTypeDescription
cp1xnumFirst control point X
cp1ynumFirst control point Y
cp2xnumSecond control point X
cp2ynumSecond control point Y
xnumEnd point X
ynumEnd point Y
GAME.OVERLAY.bezierCurveTo(0, 0, 0, 0, 0, 10);

OVERLAY.clear

client

Clear the entire overlay canvas

Signature: action()

GAME.OVERLAY.clear();

OVERLAY.closePath

client

Close the current drawing path

Signature: action()

GAME.OVERLAY.closePath();

OVERLAY.drawCircle

client

Draw an ellipse on the overlay

Signature: action(num, num, num, num, num, str, num, bool)

Parameters:

NameTypeDescription
xnumX position
ynumY position
wnumWidth (horizontal radius)
hnumHeight (vertical radius)
rnumRotation angle in degrees
colorstrFill color (hex)
opacnumOpacity (0-1)
centerboolWhether to center the ellipse at the position
GAME.OVERLAY.drawCircle(0, 10, 5, 5, 255, "#FF0000", 0, true);

OVERLAY.drawImage

client

Draw an image asset on the overlay canvas

Signature: action(num, num, num, num, num, num, num)

Parameters:

NameTypeDescription
aidnumAsset ID of the image
xnumX position (center)
ynumY position (center)
wnumWidth
hnumHeight
rnumRotation angle in degrees
opacnumOpacity (0-1)
GAME.OVERLAY.drawImage("asset_id", 0, 10, 5, 5, 255, 0);

OVERLAY.drawLine

client

Draw a line between two points on the overlay

Signature: action(num, num, num, num, num, str, num)

Parameters:

NameTypeDescription
x1numStarting X position
y1numStarting Y position
x2numEnding X position
y2numEnding Y position
thicknessnumLine thickness
colorstrLine color (hex)
opacnumOpacity (0-1)
GAME.OVERLAY.drawLine(0, 10, 0, 10, 0, "#FF0000", 0);

OVERLAY.drawRect

client

Draw a rectangle on the overlay

Signature: action(num, num, num, num, num, str, num, bool)

Parameters:

NameTypeDescription
xnumX position
ynumY position
wnumWidth
hnumHeight
rnumRotation angle in degrees
colorstrFill color (hex)
opacnumOpacity (0-1)
centerboolWhether to center the rectangle at the position
GAME.OVERLAY.drawRect(0, 10, 5, 5, 255, "#FF0000", 0, true);

OVERLAY.drawText

client

Draw text on the overlay canvas

Signature: action(str, num, num, num, num, str, str, num, str)

Parameters:

NameTypeDescription
textstrText content to display
xnumX position
ynumY position
rnumRotation angle in degrees
sizenumFont size in pixels
alignstrText alignment (left, center, right)
colorstrFill color (hex)
opacnumOpacity (0-1)
fontstrFont family name
GAME.OVERLAY.drawText("Hello", 0, 10, 255, 0, "value", "#FF0000", 0, "Arial");

OVERLAY.ellipse

client

Add an ellipse to the current path

Signature: action(num, num, num, num, num, num, num, bool)

Parameters:

NameTypeDescription
xnumCenter X position
ynumCenter Y position
radiusXnumHorizontal radius
radiusYnumVertical radius
rotationnumRotation in radians
startAnglenumStart angle in radians
endAnglenumEnd angle in radians
counterClockwiseboolDraw counter-clockwise
GAME.OVERLAY.ellipse(0, 10, 0, 0, 0, 0, 0, true);

OVERLAY.fill

client

Fill the current path with the fill style

Signature: action()

GAME.OVERLAY.fill();

OVERLAY.fillStyle

client

Set the fill color for subsequent fill operations

Signature: action(str)

Parameters:

NameTypeDescription
colorstrFill color (hex)
GAME.OVERLAY.fillStyle("#FF0000");

OVERLAY.getSize

client

Get the current overlay canvas dimensions

Signature: obj action()

Returns: obj - Object with width and height properties

obj size = GAME.OVERLAY.getSize();

OVERLAY.globalAlpha

client

Set the global transparency for all drawing operations

Signature: action(num)

Parameters:

NameTypeDescription
valnumAlpha value (0-1)
GAME.OVERLAY.globalAlpha(100);

OVERLAY.lineDashOffset

client

Set the line dash offset for dashed lines

Signature: action(num)

Parameters:

NameTypeDescription
offsetnumDash offset value
GAME.OVERLAY.lineDashOffset(0);

OVERLAY.lineJoin

client

Set how lines join together (bevel, round, or miter)

Signature: action(str)

Parameters:

NameTypeDescription
optionstrJoin style: 'bevel', 'round', or 'miter'
GAME.OVERLAY.lineJoin("value");

OVERLAY.lineTo

client

Draw a line from current position to a new position

Signature: action(num, num)

Parameters:

NameTypeDescription
xnumTarget X position
ynumTarget Y position
GAME.OVERLAY.lineTo(0, 10);

OVERLAY.lineWidth

client

Set the line width for stroke operations

Signature: action(num)

Parameters:

NameTypeDescription
widthnumLine width in pixels
GAME.OVERLAY.lineWidth(5);

OVERLAY.measureText

client

Measure the width of text without rendering it

Signature: num action(num, str, str)

Parameters:

NameTypeDescription
sizenumFont size in pixels
textstrText to measure
fontstrFont family name

Returns: num - Width of the text in pixels

num result = GAME.OVERLAY.measureText(0, "Hello", "Arial");

OVERLAY.moveTo

client

Move the path cursor to a position without drawing

Signature: action(num, num)

Parameters:

NameTypeDescription
xnumX position
ynumY position
GAME.OVERLAY.moveTo(0, 10);

OVERLAY.offset

client

Offset the canvas drawing origin by translating it

Signature: action(num, num)

Parameters:

NameTypeDescription
xnumX offset amount
ynumY offset amount
GAME.OVERLAY.offset(0, 10);

OVERLAY.quadraticCurveTo

client

Add a quadratic bezier curve to the path

Signature: action(num, num, num, num)

Parameters:

NameTypeDescription
cpxnumControl point X
cpynumControl point Y
xnumEnd point X
ynumEnd point Y
GAME.OVERLAY.quadraticCurveTo(0, 0, 0, 10);

OVERLAY.restore

client

Restore the canvas state from the stack

Signature: action()

GAME.OVERLAY.restore();

OVERLAY.save

client

Save the current canvas state to the stack

Signature: action()

GAME.OVERLAY.save();

OVERLAY.scale

client

Scale the canvas uniformly

Signature: action(num)

Parameters:

NameTypeDescription
sclnumScale factor
GAME.OVERLAY.scale(1);

OVERLAY.setTransform

client

Reset and set the transformation matrix

Signature: action(num, num, num, num, num, num)

Parameters:

NameTypeDescription
anumHorizontal scaling
bnumHorizontal skewing
cnumVertical skewing
dnumVertical scaling
enumHorizontal moving
fnumVertical moving
GAME.OVERLAY.setTransform(0, 0, 0, 0, 0, 0);

OVERLAY.stroke

client

Stroke (outline) the current path

Signature: action()

GAME.OVERLAY.stroke();

OVERLAY.strokeRect

client

Draw a rectangle outline (stroke only)

Signature: action(num, num, num, num)

Parameters:

NameTypeDescription
xnumX position
ynumY position
widthnumRectangle width
heightnumRectangle height
GAME.OVERLAY.strokeRect(0, 10, 5, 5);

OVERLAY.strokeStyle

client

Set the stroke color for subsequent stroke operations

Signature: action(str)

Parameters:

NameTypeDescription
colorstrStroke color (hex)
GAME.OVERLAY.strokeStyle("#FF0000");

OVERLAY.strokeText

client

Draw text outline (stroke) at a position

Signature: action(str, num, num, num)

Parameters:

NameTypeDescription
textstrText to draw
xnumX position
ynumY position
maxWidthnumMaximum width for the text
GAME.OVERLAY.strokeText("Hello", 0, 10, 0);

OVERLAY.transform

client

Apply a transformation matrix to the canvas

Signature: action(num, num, num, num, num, num)

Parameters:

NameTypeDescription
anumHorizontal scaling
bnumHorizontal skewing
cnumVertical skewing
dnumVertical scaling
enumHorizontal moving
fnumVertical moving
GAME.OVERLAY.transform(0, 0, 0, 0, 0, 0);

OVERLAY.translate

client

Translate (move) the canvas origin

Signature: action(num, num)

Parameters:

NameTypeDescription
xnumX translation amount
ynumY translation amount
GAME.OVERLAY.translate(0, 10);