Skip to content

class Draw (client-side)

Available since version: 0.1.0

This class represents text visible on the screen.

Constructor

int x, int y, string text

Parameters:

  • int x: the x position in virtuals.
  • int y: the y position in virtuals.
  • string text: the text to be shown.

Properties

bool visible

Available since version: 0.1.0

Represents the visibility state of the text.


string text

Available since version: 0.1.0

Represents the text displayed by the draw.


string font

Available since version: 0.1.0

Represents the font name used by the text.


int alpha

Available since version: 0.1.10

Represents the text alpha color component in RGBA model.


float rotation

Available since version: 0.1.10

Note

To change that center of rotation, see setPivotPoint and setPivotPointPx.

Represents the rotation of the text in degrees.
The rotation is performed clockwise around the draw pivot point.


int width (read-only)

Available since version: 0.1.0

Represents the width of the text in virtuals.


int widthPx (read-only)

Available since version: 0.1.0

Represents the width of the text in pixels.


int height (read-only)

Available since version: 0.1.0

Represents the height of the text in virtuals.


int heightPx (read-only)

Available since version: 0.1.0

Represents the height of the text in pixels.


Methods

top

Available since version: 0.1.0

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()

setColor

Available since version: 0.1.0

This method will set the text color.

void setColor(int r, int g, int b)

Parameters:

  • 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.

getColor

Available since version: 0.1.0

This method will get the text color.

{r, g, b} getColor()

Returns {r, g, b}:

the draw color.


setAlpha

Deprecated since version: 0.1.10

This method will set the text alpha channel.

void setAlpha(int alpha)

Parameters:

  • int alpha: the alpha color component in RGBA model.

getAlpha

Deprecated since version: 0.1.10

This method will get the text alpha channel.

int getAlpha()

Returns int:

the alpha color component in RGBA model.


setRotation

Deprecated since version: 0.1.10

This method will set the rotation of the text in degrees.
The rotation is performed clockwise around the draw pivot point.

void setRotation(float angle)

Parameters:

  • float angle: the rotation angle of the draw in degrees.

getRotation

Deprecated since version: 0.1.10

This method will get the rotation of the text in degrees.

float getRotation()

Returns float:

the rotation angle of the draw in degrees.


setScale

Available since version: 0.1.10

This method will set the scale of the text.

void setScale(float width, float height)

Parameters:

  • float width: the scale factor on x axis.
  • float height: the scale factor on y axis.

getScale

Available since version: 0.1.10

This method will get the scale of the text.

{width, height} getScale()

Returns {width, height}:

the draw scale.


setPosition

Available since version: 0.1.0

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

void setPosition(int x, int y)

Parameters:

  • int x: the x position in virtuals.
  • int y: the y position in virtuals.

getPosition

Available since version: 0.1.0

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

{x, y} getPosition()

Returns {x, y}:

the draw position on screen.


setPositionPx

Available since version: 0.1.0

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

void setPositionPx(int x, int y)

Parameters:

  • int x: the x position in pixels.
  • int y: the y position in pixels.

getPositionPx

Available since version: 0.1.0

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

{x, y} getPositionPx()

Returns {x, y}:

the draw position on screen.


setPivotPoint

Available since version: 0.1.10

This method will set the pivot point of the text in virtuals (Offset from the center of the draw).
All rotations will be done relative to this point.

void setPivotPoint(int x, int y)

Parameters:

  • int x: the x offset in virtuals.
  • int y: the y offset in virtuals.

setPivotPointPx

Available since version: 0.1.10

This method will set the pivot point of the text in pixels (Offset from the center of the draw).
All rotations will be done relative to this point.

void setPivotPointPx(int x, int y)

Parameters:

  • int x: the x offset in pixels.
  • int y: the y offset in pixels.

getPivotPoint

Available since version: 0.1.10

This method will get the pivot point of the text in virtuals (Offset from the center of the draw).

{x, y} getPivotPoint()

Returns {x, y}:

the offset in virtuals. The default pivot point value is {x=0,y=0}


getPivotPointPx

Available since version: 0.1.10

This method will get the pivot point of the text in pixels (Offset from the center of the draw).

{x, y} getPivotPointPx()

Returns {x, y}:

the offset in pixels. The default pivot point value is {x=0,y=0}