Render

Warning

If you are looking for how to make UIs, we recommend taking a look at WebUI for a more robust and optimal system.

Tip

This is a Static Class named Render. You can access it’s methods directly with :. It is not possible to initialize or create new instances.

Note

This is a Client only Class.

Tip

The following functions have an GroupID parameter, which you can group related Canvas Items with an ID to facilitate the cleanup of them, or can give them Unique IDs. These return an ItemID value, which can be used for updating specific Canvas Items afterwards.

Functions

Returns

Name

Description

number ItemID

AddLine(number GroupID, Vector2D StartPosition, Vector2D EndPosition, number Thickness, Color Color)

Draws a Line (doesn’t support opacity)

number ItemID

AddBox(number GroupID, Vector2D StartPosition, Vector2D EndPosition, number Thickness, Color Color)

Draws a Box

number ItemID

AddTile(number GroupID, Vector2D Position, Vector2D Size, Color Color)

Draws a Tile (filled)

number ItemID

AddPolygon(number GroupID, Vector2D ScreenPosition, Vector2D Radius, number NumberOfSides, Color Color)

Draws a Polygon

number ItemID

AddText(number GroupID, string Text, Vector2D Position, number FontType, number FontSize, Color TextColor, number Kerning, boolean bCenterX, boolean bCenterY, boolean EnableShadow, Vector2D ShadowOffset, Color ShadowColor, boolean EnableOutline, Color OutlineColor)

Draws a Text with optionals Shadow and Outline

Vector2D

Project(Vector WorldPosition)

Transforms a 3D world-space vector into 2D screen coordinates.

Vector

Deproject(Vector2D ScreenPosition)

Transforms a 2D screen coordinates into 3D world-space location.

ClearItems(number GroupID)

Remove all drawing of using that specific GroupID

UpdateItemText(number GroupID, number ItemID, string NewText)

Updates a specific Canvas Text giving it’s GroupID and ItemID

UpdateItemPosition(number GroupID, number ItemID, Vector2D NewPosition)

Updates a specific Canvas’s position giving it’s GroupID and ItemID

Vector2D

GetViewportSize()

Returns the size of viewport (how much screen space the game window occupies)

Events

Name

Parameters

Description

ViewportResized

Vector2D NewSize

Called when the screen is resized

Available Fonts

ID

Name

0

Roboto

1

Gothic A1

2

Poiret One

Examples

Render:AddText(0, text, location, fontType, fontSize, textColor, kerning, bCenterX, bCenterY, bEnableShadow, shadowOffset, shadowColor, bOutlined, outlineColor)