đ¨render
Functions:
screen_size
render.screen_size():
vector
camera_position
render.camera_position():
vector
Returns the camera position vector.
camera_angles
render.camera_angles([angles: vector]):
vector
Name | Type | Description |
---|---|---|
angles |
| New camera angles |
Returns or sets the camera angles.
world_to_screen
render.world_to_screen(position: vector):
vector
Name | Type | Description |
---|---|---|
position |
| Position in world space |
đ Note that there is a cleaner alternative, the :to_screen
vector function.
Returns the screen position vector, or nil if the world position is not visible on your screen. This can only be called from the render callback.
get_offscreen
render.get_offscreen(position: vector, radius: number[, accurate: boolean]):
vector
, number
, boolean
Name | Type | Description |
---|---|---|
position |
| Position in world space |
radius |
| Distance from the center of the screen as a percentage in the range [0.0, â] |
accurate |
| Optional. If |
Returns the position
, rotation
, and is_out_of_fov
arguments or nil on failure.
position
: Screen coordinates (Returns ellipse-based position if the world position is out of FOV)
rotation
: Yaw axis that can be used to rotate drawing stuff
is_out_of_fov
: Returns true
if the world position is out of FOV.
get_pixel
render.get_pixel(position: vector)
Getting the color of the pixel is a heavy process. Do not do it inside callbacks that are called a lot of times per second.
Name | Type | Description |
---|---|---|
position |
| Screen position |
Returns the color of the specified pixel on the screen.
load_font
đ Render any text via the draw:text
function.
render.load_font(name: string, size: number[, flags: string]):
FontObject
Name | Type | Description |
---|---|---|
name |
| Font that will be initialized |
size |
| Size of the font |
flags |
|
|
Returns the FontObject
struct or nil on failure.
load_image
đ Render any image via the :texture
function.
render.load_image(contents: string, size: vector):
ImgObject
Name | Type | Description |
---|---|---|
contents |
| Raw image file contents |
size |
| Size of the image |
Returns the ImgObject
struct or nil on failure. Supports JPG, PNG, BMP, SVG, and GIF formats.
load_image_rgba
đ Render any image via the :texture
function.
render.load_image_rgba(contents: string, size: vector):
ImgObject
Name | Type | Description |
---|---|---|
contents |
|
|
size |
| Size of the image |
Returns the ImgObject
struct or nil on failure.
load_image_from_file
đ Render any image via the :texture
function.
render.load_image_from_file(path: string, size: vector):
ImgObject
Name | Type | Description |
---|---|---|
path |
| Path to the image |
size |
| Size of the image |
âšī¸ Loading images from game resources is supported.
Example:
render.load_image_from_file 'materials/panorama/images/icons/ui/warning.svg'
Returns the ImgObject
struct or nil on failure. Supports JPG, PNG, BMP, SVG, and GIF formats.
measure_text
render.measure_text(font: FontObject[, flags: string], text: string):
vector
Name | Type | Description |
---|---|---|
font |
| Font object or |
flags |
| Optional. |
text |
| Text that will be measured |
Returns the measured size of the text.
highlight_hitbox
render.highlight_hitbox(entity: entity, hitbox: number, color: color)
Name | Type | Description |
---|---|---|
entity |
| The player whose hitbox(es) are to be highlighted. |
hitbox |
| Hitbox index (an integer between 0 and 18). A table with hitbox indices can also be used to highlight multiple hitboxes. Pass 19 to highlight every hitbox. |
color |
| The color with which you want to highlight the hitbox(es). |
Highlights the specified hitbox / hitboxes.
get_scale
render.get_scale(type: number):
number
Name | Type | Description |
---|---|---|
type |
| The type of DPI scale to return.
|
Returns the DPI scale value.
Structs
đ ImgObject
ImgObject
width
img.width
:
number
height
img.height
:
number
resolution
img.resolution
:
number
đ FontObject
FontObject
width
font.width
:
number
height
font.height
:
number
spacing
font.spacing
:
number
:set_size
font:set_size(size: number)
Name | Type | Description |
---|---|---|
size |
| New size of the font |
Sets the new font size.
Draw functions
blur
render.blur(position_a: vector, position_b: vector, strength: number, alpha: number[, rounding: number])
Name | Type | Description |
---|---|---|
position_a |
| Start position |
position_b |
| End position |
strength |
| Blur strength |
alpha |
| Alpha percentage in the range [0.0, 1.0] |
rounding |
| Optional. Rounding of the blur rectangle in pixels |
line
render.line(position_a: vector, position_b: vector, color: color)
Name | Type | Description |
---|---|---|
position_a |
| Start position |
position_b |
| End position |
color |
| Color of the line |
poly
render.poly(color: color, positions: vector[, ...])
Name | Type | Description |
---|---|---|
color |
| Color of the polyline |
positions |
| Screen positions |
... | Comma-separated vectors to concatenate with |
poly_blur
render.poly_blur(opacity: number, strength: number, positions: vector[, ...])
Name | Type | Description |
---|---|---|
opacity |
| Opacity percentage in the range [0.0, 1.0] |
strength |
| Blur strength |
positions |
| Screen positions |
... | Comma-separated vectors to concatenate with |
poly_line
render.poly_line(color: color, positions: vector[, ...])
Name | Type | Description |
---|---|---|
color |
| Color of the polyline |
positions |
| Screen positions |
... | Comma-separated vectors to concatenate with |
rect
render.rect(position_a: vector, position_b: vector, color: color[, rounding: number, no_clamp: boolean])
Name | Type | Description |
---|---|---|
position_a |
| Start position |
position_b |
| End position |
color |
| Color of the rectangle |
rounding |
| Optional. Rounding of the rectangle in pixels |
no_clamp |
| Optional. If |
rect_outline
render.rect_outline(position_a: vector, position_b: vector, color: color[, thickness: number, rounding: number, no_clamp: boolean])
Name | Type | Description |
---|---|---|
position_a |
| Start position |
position_b |
| End position |
color |
| Color of the rectangle |
thickness |
| Optional. Thickness of the rectangle in pixels |
rounding |
| Optional. Rounding of the rectangle in pixels |
no_clamp |
| Optional. If |
gradient
render.gradient(position_a: vector, position_b: vector, top_left: color, top_right: color, bottom_left: color, bottom_right: color[, rounding: number])
Name | Type | Description |
---|---|---|
position_a |
| Start position |
position_b |
| End position |
top_left |
| Color of the top left rectangle position |
top_right |
| Color of the top right rectangle position |
bottom_left |
| Color of the bottom left rectangle position |
bottom_right |
| Color of the bottom right rectangle position |
rounding |
| Optional. Rounding of the gradient in pixels |
circle
render.circle(position: vector, color: color, radius: number, start_deg: number, pct: number)
Name | Type | Description |
---|---|---|
position |
| Screen position |
color |
| Color of the circle |
radius |
| Radius of the circle in pixels |
start_deg |
|
|
pct |
| Percentage in the range [0.0-1.0] determining how full the circle is |
circle_outline
render.circle_outline(position: vector, color: color, radius: number, start_deg: number, pct: number[, thickness: number])
Name | Type | Description |
---|---|---|
position |
| Screen position |
color |
| Color of the circle |
radius |
| Radius of the circle in pixels |
start_deg |
|
|
pct |
| Percentage in the range [0.0-1.0] determining how full the circle is |
thickness |
| Optional. Thickness of the outline in pixels |
circle_gradient
render.circle_gradient(position: vector, color_outer: color, color_inner: color, radius: number, start_deg: number, pct: number)
Name | Type | Description |
---|---|---|
position |
| Screen position |
color_outer |
| Outer color of the circle |
color_inner |
| Inner color of the circle |
radius |
| Radius of the circle in pixels |
start_deg |
|
|
pct |
| Percentage in the range [0.0-1.0] determining how full the circle is |
circle_3d
render.circle_3d(position: vector, color: color, radius: number, start_deg: number, pct: number[, outline: boolean])
Name | Type | Description |
---|---|---|
position |
| Screen position |
color |
| Color of the circle |
radius |
| Radius of the circle in pixels |
start_deg |
|
|
pct |
| Percentage in the range [0.0-1.0] determining how full the circle is |
outline |
| Optional. Render the circle outline |
circle_3d_outline
render.circle_3d_outline(position: vector, color: color, radius: number, start_deg: number, pct: number[, thickness: number])
Name | Type | Description |
---|---|---|
position |
| Screen position |
color |
| Color of the circle |
radius |
| Radius of the circle in pixels |
start_deg |
|
|
pct |
| Percentage in the range [0.0-1.0] determining how full the circle is |
thickness |
| Thickness of the outline in pixels |
circle_3d_gradient
render.circle_3d_gradient(position: vector, color_outer: color, color_inner: color, radius: number, start_deg: number, pct: number)
Name | Type | Description |
---|---|---|
position |
| Screen position |
color_outer |
| Outer color of the circle |
color_inner |
| Inner color of the circle |
radius |
| Radius of the circle in pixels |
start_deg |
|
|
pct |
| Percentage in the range [0.0-1.0] determining how full the circle is |
text
đ Render any text via the :load_font
function.
render.text(font: FontObject, position: vector, color: color, flags: string, text:any[, ...])
Name | Type | Description |
---|---|---|
font |
| Font object or |
position |
| Screen position |
color |
| Color of the text |
flags |
|
|
text |
| Text that will be drawn |
... | Comma-separated vectors to concatenate with |
Draws the specified text.
texture
đ Create the texture via the :load_image
function.
render.texture(texture: ImgObject, position: vector[, size: vector, color: color, mode: string, rounding: number])
Name | Type | Description |
---|---|---|
texture |
| Image object |
position |
| Screen position |
size |
| Optional. Size of the texture |
color |
| Optional. Color of the texture |
mode |
| Optional. |
rounding |
| Optional. Roundness of the texture |
push_rotation
render.push_rotation(degrees: number)
Name | Type | Description |
---|---|---|
degrees |
| Rotation degrees (0 - 360) |
Applies the rotation for all subsequent elements.
pop_rotation
render.pop_rotation()
Discards an early set rotation.
push_clip_rect
render.push_clip_rect(pos_a: vector, pos_b: vector[, intersect: boolean])
Name | Type | Description |
---|---|---|
pos_a |
| Screen position of point A |
pos_b |
| Screen position of point B |
intersect |
| Optional. Allow intersections with other clip regions |
Applies the clip region to the given rectangle for all subsequent elements.
pop_clip_rect
render.pop_clip_rect()
Discards an early set rectangle clipping region.
shadow
render.shadow(pos_a: vector, pos_b: vector, clr: color[, thickness: number, offset: number, rounding: number])
Name | Type | Description |
---|---|---|
pos_a |
| Screen position of point A |
pos_b |
| Screen position of point B |
clr |
| The color of the shadow |
thickness |
| The thickness of the shadow |
offset |
| Shadow offset |
rounding |
| The rounding of the shadow rectangle |
Draws a shadow rectangle.
Last updated