🎨Render

Table to work with render v2.

FilledRect(start: Vec2, end_: Vec2, color: Color, rounding [?]: number, flags [?]: Enum.DrawFlags): nil

Name
Type
Description

start

The starting point of the rectangle.

end_

The ending point of the rectangle.

color

The color of the rectangle.

rounding [?]

number

The rounding radius of the rectangle corners. (default: 0.0)

flags [?]

Custom flags for drawing. (default: Enum.DrawFlags.None)

Draws a filled rectangle.


Rect(start: Vec2, end_: Vec2, color: Color, rounding [?]: number, flags [?]: Enum.DrawFlags, thickness [?]: number): nil

Name
Type
Description

start

The starting point of the rectangle.

end_

The ending point of the rectangle.

color

The color of the rectangle's border.

rounding [?]

number

The rounding radius of the rectangle corners. (default: 0.0)

flags [?]

Custom flags for drawing. (default: Enum.DrawFlags.None)

thickness [?]

number

The thickness of the rectangle's border. (default: 1.0)

Draws an unfilled rectangle.


RoundedProgressRect(start: Vec2, end_: Vec2, color: Color, percent: number, rounding: number, thickness [?]: number): nil

Name
Type
Description

start

The starting point of the rectangle.

end_

The ending point of the rectangle.

color

The color of the rectangle.

percent

number

The percentage of the rectangle to fill [0..1].

rounding

number

The rounding radius of the rectangle corners.

thickness [?]

number

The thickness of the rectangle's border. (default: 1.0)

Draw a progress rectangle.


Line(start: Vec2, end_: Vec2, color: Color, thickness [?]: number): nil

Name
Type
Description

start

The starting point of the line.

end_

The ending point of the line.

color

The color of the line.

thickness [?]

number

The thickness of the line. (default: 1.0)

Draws a line between two points.


PolyLine(points: Vec2[], color: Color, thickness [?]: number): nil

Name
Type
Description

points

A table of Vec2 points to connect with lines.

color

The color of the polyline.

thickness [?]

number

The thickness of the polyline. (default: 1.0)

Draws a series of connected lines (polyline).


Circle(pos: Vec2, radius: number, color: Color, thickness [?]: number, startDeg [?]: number, percentage [?]: number, rounded [?]: boolean, segments [?]: integer): nil

Name
Type
Description

pos

The center position of the circle.

radius

number

The radius of the circle.

color

The color of the circle.

thickness [?]

number

The thickness of the circle's outline. (default: 1.0)

startDeg [?]

number

The starting degree for drawing the circle. 0 is right side, 90 is bottom, 180 is left, 270 is top. (default: 0.0)

percentage [?]

number

The percentage of the circle to draw, in the range [0.0-1.0]. (default: 1.0)

rounded [?]

boolean

Whether the circle is rounded. (default: false)

segments [?]

integer

The number of segments used for drawing the circle. (default: 32)

Draws a circle.


FilledCircle(pos: Vec2, radius: number, color: Color, startDeg [?]: number, percentage [?]: number, segments [?]: integer): nil

Name
Type
Description

pos

The center position of the circle.

radius

number

The radius of the circle.

color

The color of the circle.

startDeg [?]

number

The starting degree for drawing the circle. 0 is right side, 90 is bottom, 180 is left, 270 is top. (default: 0.0)

percentage [?]

number

The percentage of the circle to draw, in the range [0.0-1.0]. (default: 1.0)

segments [?]

integer

The number of segments used for drawing the circle. (default: 32)

Draws a filled circle.


CircleGradient(pos: Vec2, radius: number, colorOuter: Color, colorInner: Color, startDeg [?]: number, percentage [?]: number): nil

Name
Type
Description

pos

The center position of the circle.

radius

number

The radius of the circle.

colorOuter

The outer color of the gradient.

colorInner

The inner color of the gradient.

startDeg [?]

number

The starting degree for drawing the circle. 0 is right side, 90 is bottom, 180 is left, 270 is top. (default: 0.0)

percentage [?]

number

The percentage of the circle to draw, in the range [0.0-1.0]. (default: 1.0)

Draws a circle with a gradient.


Triangle(points: Vec2[], color: Color, thickness [?]: number): nil

Name
Type
Description

points

A table of three Vec2 points defining the vertices of the triangle.

color

The color of the triangle's outline.

thickness [?]

number

The thickness of the triangle's outline. (default: 1.0)

Draws a triangle outline.


FilledTriangle(points: Vec2[], color: Color): nil

Name
Type
Description

points

A table of three Vec2 points defining the vertices of the triangle.

color

The color of the triangle.

Draws a filled triangle.


TexturedPoly(points: Vertex[], textureHandle: integer, color: Color, grayscale [?]: number): nil

Name
Type
Description

points

A table of Vertex points defining the vertices of the polygon. Each Vertex contains a position (Vec2) and a texture coordinate (Vec2).

textureHandle

integer

The handle to the texture to be applied to the polygon.

color

The color to apply over the texture. This can be used to tint the texture.

grayscale [?]

number

The grayscale of the image. (default: 0.0)

Draws a textured polygon.


LoadFont(fontName: string, fontFlag [?]: Enum.FontCreate|integer, weight [?]: integer): integer

Name
Type
Description

fontName

string

The name of the font to load.

fontFlag [?]

Flags for font creation, such as antialiasing. (default: Enum.FontCreate.FONTFLAG_NONE)

weight [?]

integer

The weight (thickness) of the font. Typically, 0 means default weight. (default: 400)

Loads a font and returns its handle. Returns handle to the loaded font.


Text(font: integer, fontSize: number, text: string, pos: Vec2, color: Color): nil

Name
Type
Description

font

integer

The handle to the font used for drawing the text.

fontSize

number

The size of the font.

text

string

The text to be drawn.

pos

The position where the text will be drawn.

color

The color of the text.

Draws text at a specified position.


WorldToScreen(pos: Vector): Vec2, boolean

Name
Type
Description

pos

The 3D world position to be converted.

Converts a 3D world position to a 2D screen position. Returns A Vec2 representing the 2D screen position and a boolean indicating visibility on the screen.

Example

-- Example: Convert the center of the map (0,0,0) to screen coordinates.
local worldPos = Vector(0.0, 0.0, 0.0)
local screenPos, isVisible = Render.WorldToScreen(worldPos)
if isVisible then
    Log.Write("Screen Position: " .. screenPos.x .. ", " .. screenPos.y)
else
    Log.Write("Position is not visible on the screen")
end

ScreenSize(): Vec2

Retrieves the current screen size, returning it as a Vec2 where x is the width and y is the height of the screen.


TextSize(font: integer, fontSize: number, text: string): Vec2

Name
Type
Description

font

integer

The handle to the font used for measuring the text.

fontSize

number

The size of the font.

text

string

The text to measure.

Calculates the size of the given text using the specified font, returning the size as a Vec2 where x is the width and y is the height of the text.


LoadImage(path: string): integer

Name
Type
Description

path

string

Path to the image.

Loads an image and returns its handle.


Image(imageHandle: integer, pos: Vec2, size: Vec2, color: Color, rounding [?]: number, flags [?]: Enum.DrawFlags, uvMin [?]: Vec2, uvMax [?]: Vec2, grayscale [?]: number): nil

Name
Type
Description

imageHandle

integer

The handle to the image.

pos

The position to draw the image.

size

The size of the image.

color

The color to tint the image.

rounding [?]

number

The rounding radius of the image corners. (default: 0.0)

flags [?]

Custom flags for drawing. (default: Enum.DrawFlags.None)

uvMin [?]

The minimum UV coordinates for texture mapping. (default: {0.0, 0.0})

uvMax [?]

The maximum UV coordinates for texture mapping. (default: {1.0, 1.0})

grayscale [?]

number

The grayscale of the image. (default: 0.0)

Draws an image at a specified position and size.


ImageCentered(imageHandle: integer, pos: Vec2, size: Vec2, color: Color, rounding [?]: number, flags [?]: Enum.DrawFlags, uvMin [?]: Vec2, uvMax [?]: Vec2, grayscale [?]: number): nil

Name
Type
Description

imageHandle

integer

The handle to the image.

pos

The center position to draw the image.

size

The size of the image.

color

The color to tint the image.

rounding [?]

number

The rounding radius of the image corners. (default: 0.0)

flags [?]

Custom flags for drawing. (default: Enum.DrawFlags.None)

uvMin [?]

The minimum UV coordinates for texture mapping. (default: {0.0, 0.0})

uvMax [?]

The maximum UV coordinates for texture mapping. (default: {1.0, 1.0})

grayscale [?]

number

The grayscale of the image. (default: 0.0)

Draws an image centered at a specified position and size.


ImageSize(imageHandle: integer): Vec2

Name
Type
Description

imageHandle

integer

The handle to the image.

Retrieves the size of an image. Returns the size of the image as a Vec2.


OutlineGradient(start: Vec2, end_: Vec2, topLeft: Color, topRight: Color, bottomLeft: Color, bottomRight: Color, rounding [?]: number, flags [?]: Enum.DrawFlags, thickness [?]: number): nil

Name
Type
Description

start

The starting point of the gradient rectangle.

end_

The ending point of the gradient rectangle.

topLeft

The color of the top-left corner.

topRight

The color of the top-right corner.

bottomLeft

The color of the bottom-left corner.

bottomRight

The color of the bottom-right corner.

rounding [?]

number

The rounding radius of the rectangle corners. (default: 0.0)

flags [?]

Custom flags for drawing. (default: Enum.DrawFlags.None)

thickness [?]

number

The thickness of the outline. (default: 1.0)

Draws a outlined gradient rectangle.


Gradient(start: Vec2, end_: Vec2, topLeft: Color, topRight: Color, bottomLeft: Color, bottomRight: Color, rounding [?]: number, flags [?]: Enum.DrawFlags): nil

Name
Type
Description

start

The starting point of the gradient rectangle.

end_

The ending point of the gradient rectangle.

topLeft

The color of the top-left corner.

topRight

The color of the top-right corner.

bottomLeft

The color of the bottom-left corner.

bottomRight

The color of the bottom-right corner.

rounding [?]

number

The rounding radius of the rectangle corners. (default: 0.0)

flags [?]

Custom flags for drawing. (default: Enum.DrawFlags.None)

Draws a filled gradient rectangle.


Shadow(start: Vec2, end_: Vec2, color: Color, thickness: number, obj_rounding [?]: number, flags [?]: Enum.DrawFlags, offset [?]: Vec2): nil

Name
Type
Description

start

The starting point of the shadow rectangle.

end_

The ending point of the shadow rectangle.

color

The color of the shadow.

thickness

number

The thickness of the shadow.

obj_rounding [?]

number

The rounding radius of the shadow rectangle corners. (default: 0.0)

flags [?]

Custom flags for drawing the shadow. (default: Enum.DrawFlags.ShadowCutOutShapeBackground)

offset [?]

The offset of the shadow from the original rectangle. (default: {0.0, 0.0})

Draws a shadow effect within a specified rectangular area.


ShadowCircle(center: Vec2, radius: number, color: Color, thickness: number, num_segments [?]: integer, flags [?]: Enum.DrawFlags, offset [?]: Vec2): nil

Name
Type
Description

center

The center point of the circle.

radius

number

The radius of the circle.

color

The color of the shadow.

thickness

number

The thickness of the shadow.

num_segments [?]

integer

The number of segments for drawing the circle. (default: 12)

flags [?]

Custom flags for drawing the shadow. (default: Enum.DrawFlags.ShadowCutOutShapeBackground)

offset [?]

The offset of the shadow from the circle. (default: {0.0, 0.0})

Draws a circle shadow effect.


ShadowConvexPoly(points: Vec[], color: Color, thickness: number, flags [?]: Enum.DrawFlags, offset [?]: Vec2): nil

Name
Type
Description

points

Vec[]

Table of Vec2 points defining the convex polygon. Should be more than 2 points.

color

The color of the shadow.

thickness

number

The thickness of the shadow.

flags [?]

Custom flags for drawing the shadow. (default: Enum.DrawFlags.ShadowCutOutShapeBackground)

offset [?]

The offset of the shadow from the polygon. (default: {0.0, 0.0})

Draws a shadow convex polygon effect.


ShadowNGon(center: Vec2, radius: number, color: Color, thickness: number, num_segments: integer, flags [?]: Enum.DrawFlags, offset [?]: Vec2): nil

Name
Type
Description

center

The center point of the n-gon.

radius

number

The radius of the n-gon.

color

The color of the shadow.

thickness

number

The thickness of the shadow.

num_segments

integer

The number of segments (sides) of the n-gon.

flags [?]

Custom flags for drawing the shadow. (default: Enum.DrawFlags.ShadowCutOutShapeBackground)

offset [?]

The offset of the shadow from the n-gon. (default: {0.0, 0.0})

Draws a shadow n-gon (polygon with n sides) effect.


Blur(start: Vec2, end_: Vec2, strength [?]: number, alpha [?]: number, rounding [?]: number, flags [?]: Enum.DrawFlags): nil

Name
Type
Description

start

The starting point of the blur rectangle.

end_

The ending point of the blur rectangle.

strength [?]

number

The strength of the blur effect. (default: 1.0)

alpha [?]

number

The alpha value of the blur effect. (default: 1.0)

rounding [?]

number

The rounding radius of the blur rectangle corners. (default: 0.0)

flags [?]

Custom flags for the blur effect. (default: Enum.DrawFlags.None)

Applies a blur effect within a specified rectangular area.


PushClip(start: Vec2, end_: Vec2, intersect [?]: boolean): nil

Name
Type
Description

start

The starting point of the clipping rectangle.

end_

The ending point of the clipping rectangle.

intersect [?]

boolean

If true, the new clipping area is intersected with the current clipping area. (default: false)

Begins a new clipping region. Only the rendering within the specified rectangular area will be displayed.


PopClip(): nil

Ends the most recently begun clipping region, restoring the previous clipping region.


StartRotation(angle: number): nil

Name
Type
Description

angle

number

The rotation angle.

Begins a new rotation.


StopRotation(): nil

End the rotation.


SetGlobalAlpha(alpha: number): nil

Do not forget to reset the global alpha value after your rendering.

Name
Type
Description

alpha

number

The alpha value to set [0..1]

Set the global alpha value for rendering.


ResetGlobalAlpha(): nil

Reset the global alpha value for rendering to 1.0.

Last updated