Render

Tip

This is a namespace named Render. It is not possible to initialize or create Instances. It’s just a name with Functions and Events which are accessed with . instead of :. This is going to be changed soon ;).

Note

This is a Client only Namespace.

Attention

This page is under construction.

Attention

The usage of this feature is very unstable and will probably cause crashes and memory leaks. This will soon receive a update adding more functions and optimizing this ones.

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

StrLen(string Text, number FontType, number, FontSize)

Returns the Length of Text in Pixels

Vector

Project(Vector Location3D)

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

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

Note

The following events are Global Events. This gonna be changed soon.

Name

Parameters

Description

ViewportResized

Vector2D NewSize

Called when the screen is resized

Examples

This uses a Global Event, this will be changed soon.

text = "Hello" -- Text to render on the Canvas.
location = Vector2D(123, 321) -- Screen space position to render the text.
fontType = 0 -- Roboto
fontSize = 32 -- Size of the font
textColor = Color(1, 0, 0, 1) -- Color to render the text.
kerning = 0 -- Horizontal spacing adjustment to modify the spacing between each letter.
shadowColor = Color(1, 1, 1, 1) -- Color to render the shadow of the text.
shadowOffset = Vector2D(1, 1) -- Pixel offset relative to the screen space position to render the shadow of the text.
bCenterX = false -- If true, then interpret the screen space position X coordinate as the center of the rendered text.
bCenterY = false -- If true, then interpret the screen space position Y coordinate as the center of the rendered text.
bOutlined = false -- If true, then the text should be rendered with an outline.
bEnableShadow = true -- If true, then shadow will be enabled
outlineColor = Color(1, 1, 1, 1) -- Color to render the outline for the text.

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

Available Fonts

ID

Name

0

Roboto

1

Gothic A1

2

Poiret One