Skip to content

class Draw3d (client-side)

Available since version: 0.1.0

This class represents text visible on the screen.
The text will be shown and follow specified world position, when player is in the distance.

Constructor

Draw3d(float x, float y, float z)

Parameters:

  • float x: the position in the world on the x axis.
  • float y: the position in the world on the y axis.
  • float z: the position in the world on the z axis.

Properties

bool visible

Represents the visibility state of the text.


string font

Represents the font name used by the text.


Color& color

Available since version: 0.3.0

Represents the text color in RGBA model.


int distance

Available since version: 0.1.5.6

Represents the minimum distance needed between player and draw3d, in order to display it.


int width (read-only)

Available since version: 0.1.10

Represents the width of the text in virtuals.


int widthPx (read-only)

Available since version: 0.1.10

Represents the width of the text in pixels.


int height (read-only)

Available since version: 0.1.10

Represents the height of the text in virtuals.


int heightPx (read-only)

Available since version: 0.1.10

Represents the height of the text in pixels.


int linesCount (read-only)

Available since version: 0.2.1

Represents the number of text lines.


Methods

top

This method will move the draw text at the end of the render queue.
It will be visible at the top of the screen (other elements will be covered by it).

void top()

setLineFont

Available since version: 0.1.10

This method will set the line of text alpha channel.

void setLineFont(int position, int alpha)

Parameters:

  • int position: the position of target line in the draw3d.
  • int alpha: the alpha color component in RGBA model.

getLineFont

Available since version: 0.1.10

This method will get the line of text alpha channel.

int getLineFont(int position)

Parameters:

  • int position: the position of target line in the draw3d.

Returns int:

the alpha color component in RGBA model.


setLineColor

Available since version: 0.1.10

This method will set the line of text color.

void setLineColor(int position, int r, int g, int b)

Parameters:

  • int position: the position of target line in the draw3d.
  • int r: the red color component in RGB model.
  • int g: the green color component in RGB model.
  • int b: the blue color component in RGB model.

getLineColor

Available since version: 0.1.10

This method will get the line of text color.

Color getLineColor(int position)

Parameters:

  • int position: the position of target line in the draw3d.

Returns Color:

the line of text color.


setLineAlpha

Available since version: 0.1.10

This method will set the line of text alpha channel.

void setLineAlpha(int position, int alpha)

Parameters:

  • int position: the position of target line in the draw3d.
  • int alpha: the alpha color component in RGBA model.

getLineAlpha

Available since version: 0.1.10

This method will get the text alpha channel.

int getLineAlpha(int position)

Parameters:

  • int position: the position of target line in the draw3d.

Returns int:

the alpha color component in RGBA model.


insertText

This method will insert new line of text to the draw, moving all previously existing below.

void insertText(string text)

Parameters:

  • string text: the text that will be inserted.

removeText

This method will remove line of text from the draw at the specified position, moving up all lines below.

void removeText(int position)

Parameters:

  • int position: the position of target line in the draw3d.

getText

This method will get the line text at the specified position.

string getText(int position)

Parameters:

  • int position: the position of target line in the draw3d.

Returns string:

the text at specified position.


setLineText

Available since version: 0.1.10

This method will set line of text at the specified position.

void setLineText(int position, string line)

Parameters:

  • int position: the position of target line in the draw3d.
  • string line: the line of text that will be set.

getLineText

Available since version: 0.1.10

This method will get the line of text.

string getLineText(int position)

Parameters:

  • int position: the position of target line in the draw3d.

Returns string:

the line of text.


getPosition

Available since version: 0.1.10

This method will get the text position on screen in virtuals.

Vec2i getPosition()

Returns Vec2i:

the draw position on screen.


getPositionPx

Available since version: 0.1.10

This method will get the text position on screen in pixels.

Vec2i getPositionPx()

Returns Vec2i:

the draw position on screen.


setWorldPosition

This method will set the position of the text in the world.

void setWorldPosition(float x, float y, float z)

Parameters:

  • float x: the position in the world on the x axis.
  • float y: the position in the world on the y axis.
  • float z: the position in the world on the z axis.

getWorldPosition

This method will get the position of the text in the world.

Vec3 getWorldPosition()

Returns Vec3:

the draw3d world position.