class Draw3d (client-side)
Available since version: 0.3.0
3D text drawing helper for rendering world-space text on screen.
Constructor
Draw3d.new()
Parameters:
No parameters.
Constructor
Draw3d.new(number x, number y, number z)
Parameters:
numberx: Initial X world position.numbery: Initial Y world position.numberz: Initial Z world position.
Constructor
Draw3d.new(number x, number y, number z, string text)
Parameters:
numberx: Initial X world position.numbery: Initial Y world position.numberz: Initial Z world position.stringtext: Initial text line.
Properties
{x, y, z} worldPosition
Alias for position.
table text
Represents the displayed text lines.
string font
Represents the font identifier used for rendering.
{r, g, b, a} color
Represents the Draw3d color.
number alpha
Represents the Draw3d alpha.
boolean visible
Represents whether the Draw3d object is rendered.
number distance
Represents the max render distance from the local player.
Methods
setPosition
Sets the world position used to project this text to screen space.
void setPosition(number x, number y, number z)
Parameters:
numberx: X world position.numbery: Y world position.numberz: Z world position.
getPosition
Returns the current world position.
{x, y, z} getPosition()
Returns {x, y, z}:
Table containing x,y,z world position.
insertText
Appends a text line to the Draw3d object.
void insertText(string text)
Parameters:
stringtext: Text line to append.
removeText
Removes a text line by zero-based index.
void removeText(number index)
Parameters:
numberindex: Zero-based text line index.
updateText
Updates a text line by zero-based index.
void updateText(number index, string text)
Parameters:
numberindex: Zero-based text line index.stringtext: Replacement text.
clearText
Removes all text lines.
void clearText()
getText
Returns all text lines.
table getText()
Returns table:
Array-like table of text lines.
setText
Replaces all text lines with one text line.
void setText(string text)
Parameters:
stringtext: Text to display.
setFont
Sets the font used for rendering.
void setFont(string font)
Parameters:
stringfont: Font file name.
getFont
Returns the current font file name.
string getFont()
Returns string:
Font file name.
setColor
Sets the text color.
void setColor(number r, number g, number b)
Parameters:
numberr: Red color component.numberg: Green color component.numberb: Blue color component.
getColor
Returns the text color.
{r, g, b, a} getColor()
Returns {r, g, b, a}:
Table containing color in RGBA model.
setAlpha
Sets the text alpha.
void setAlpha(number alpha)
Parameters:
numberalpha: Opacity value (0-255).
getAlpha
Returns the current alpha.
number getAlpha()
Returns number:
Opacity value (0-255).
setVisible
Sets whether the Draw3d object should render.
void setVisible(boolean visible)
Parameters:
booleanvisible: True to render, false to hide.
getVisible
Returns whether this Draw3d object is visible.
boolean getVisible()
Returns boolean:
True if visible.
setDistance
Sets the max render distance from the local player.
void setDistance(number distance)
Parameters:
numberdistance: Max distance in world units. Zero disables distance culling.
getDistance
Returns the max render distance.
number getDistance()
Returns number:
Max distance in world units.
top
Moves the Draw3d view to the top of the screen view stack.
void top()
render
Forces immediate rendering of this Draw3d object.
void render()
Callbacks
No callbacks.