c_renderer
Functions
⚠️
Renderer functions should only be called from render callback
line
Argument | Type | Required |
---|---|---|
start_pos | vec2 | + |
end_pos | vec2 | + |
color | color | + |
thickness | number | + |
local target = features.target_selector:get_default_target()
local local_on_screen = g_local.position:to_screen()
local target_on_screen = target.position:to_screen()
if target_on_screen ~= nil and local_on_screen ~= nil then
-- Draw line from local to current target
g_render:line(local_on_screen, target_on_screen, color:new(255, 255, 255, 255), 1)
end
line_3d
⚠️
This function can have a big impact on fps when called too often.
Argument | Type | Required |
---|---|---|
start_pos | vec3 | + |
end_pos | vec3 | + |
color | color | + |
thickness | number | + |
local target = features.target_selector:get_default_target()
if target ~= nil and g_local ~= nil then
-- Draw line from local to current target
g_render:line_3d(g_local.position, target.position, color:new(255, 255, 255, 255), 1)
end
box
Argument | Type | Required |
---|---|---|
start | vec2 | + |
size | vec2 | + |
color | color | + |
rounding | number | + |
thickness | number | + |
filled_box
Argument | Type | Required |
---|---|---|
start | vec2 | + |
size | vec2 | + |
color | color | + |
rounding | number | + |
circle
Argument | Type | Required |
---|---|---|
position | vec2 | + |
color | color | + |
radius | number | + |
segments | number | + |
filled_circle
Argument | Type | Required |
---|---|---|
position | vec2 | + |
color | color | + |
radius | number | + |
segments | number | + |
circle_3d
⚠️
This function can have a big impact on fps when called too often.
Argument | Type | Required |
---|---|---|
position | vec3 | + |
color | color | + |
radius | number | + |
flags | number | + |
segments | number | + |
thickness | number | + |
local target = features.target_selector:get_default_target()
if target ~= nil and g_local ~= nil then
--[[ Draw circle around current target
flags:
1 - filled circle
2 - outlined circle
4 - filled circle with outline
]]
g_render:circle_3d(target.position, color:new(255, 255, 255), 50, 2, 100, 1)
end
triangle
Argument | Type | Required |
---|---|---|
left | vec2 | + |
right | vec2 | + |
bottom | vec2 | + |
color | color | + |
thickness | number | + |
filled_triangle
Argument | Type | Required |
---|---|---|
left | vec2 | + |
right | vec2 | + |
bottom | vec2 | + |
color | color | + |
load_texture_from_file
Argument | Type | Required |
---|---|---|
file_path | string | + |
local texture = g_render:load_texture_from_file("C:\\Users\\user\\Desktop\\texture.png")
if texture ~= nil then
g_render:image(vec2:new(50, 50), vec2:new(200, 200), texture)
end
image
Argument | Type | Required |
---|---|---|
position | vec2 | + |
size | vec2 | + |
texture | texture_t | + |
local texture = g_render:load_texture_from_file("C:\\Users\\user\\Desktop\\texture.png")
if texture ~= nil then
g_render:image(vec2:new(50, 50), vec2:new(200, 200), texture)
end
get_screensize
Argument | Type | Required |
---|---|---|
returns | vec2 |
local size = g_render:get_screensize()
print("Screen size: " .. size.x .. "x" .. size.y)
circle_minimap
Argument | Type | Required |
---|---|---|
position | vec3 | + |
color | color | + |
radius | number | + |
segments | number | - |
thickness | number | - |
-- Draw cicle on minimap at local player position
g_render:cicle_minimap(g_local.position, color:new(255, 255, 255), 15)
text
Argument | Type | Required |
---|---|---|
position | vec2 | + |
color | color | + |
text | string | + |
font | string | + |
size | number | + |
-- uses fallback font when font = nil or not found
g_render:text(vec2:new(50, 50), color:new(255, 255, 255), "Hello world!", nil, 20)
get_text_size
Argument | Type | Required |
---|---|---|
text | string | + |
font | string | + |
size | number | + |
local size = g_render:get_text_size("Hello world!", nil, 20)
if size ~= nil then
print("Text size: " .. size.x .. "x" .. size.y)
end