Library
UI
Comprehensive reference for dLib’s built-in UI drawing helpers, with parameter details and usage examples.
Client Functions
Draw2DText
Draws 2D text on the screen at the specified position.
dLib.UI.Draw2DText(text, x, y, scale, color, font)| Argument | Type | Description |
|---|---|---|
text | string | The text string to display on screen. |
x | number | Horizontal screen position (0.0 left, 1.0 right). |
y | number | Vertical screen position (0.0 top, 1.0 bottom). |
scale? | number | nil | Text size multiplier (default 0.35). |
color? | table | nil | RGBA table, e.g. {r=255,g=255,b=255,a=255}; white if omitted. |
font? | number | nil | Game font ID (default 4). |
Draw3DText
Draws 3D text in the world at the specified coordinates.
dLib.UI.Draw3DText(text, coords, scale, color, font)| Argument | Type | Description |
|---|---|---|
text | string | The text string to display in the world. |
coords | vector3 | World coordinates as vector3 where the text appears. |
scale? | number | nil | Text size multiplier (default 0.35). |
color? | table | nil | RGBA table, e.g. {r=255,g=255,b=255,a=255}; white if omitted. |
font? | number | nil | Game font ID (default 4). |
DrawRect
Draws a 2D rectangle on the screen at the specified position and dimensions.
dLib.UI.DrawRect(x, y, width, height, color)| Argument | Type | Description |
|---|---|---|
x | number | Horizontal screen position (0.0 left, 1.0 right). |
y | number | Vertical screen position (0.0 top, 1.0 bottom). |
width | number | Width of the rectangle in screen units. |
height | number | Height of the rectangle in screen units. |
color? | table | nil | RGBA table, e.g. {r=255,g=255,b=255,a=255}; white if omitted. |