draw
Last updated
Last updated
draw.world_to_screen(position: vector):
vector
position
vector
Position in world space.
Returns the screen position vector. This can only be called from the on_paint callback.
draw.create_font(name: string, size: number, flags: number):
font_object
name
string
Font that will be initialized.
size
number
Size of the font.
flags
number
Returns the struct or nil on failure.
draw.create_weapon_font(size: number):
font_object
size
number
Size of the font.
Returns the struct or nil on failure.
draw.create_texture(path: string):
texture
path
string
Path to the image.
Returns the texture
or nil on failure.
draw.get_text_size(font: font_object, text: string):
vector
font
font_object
Font.
text
string
Text from which the size will be obtained.
Returns the size of the text.
font_object
font.size:
number
draw.blur(x: number, y: number: width: number, height: number, alpha: number)
x
number
X position.
y
number
Y position.
width
number
Width.
height
number
Height.
alpha
number
Alpha.
draw.line(x: number, y: number, x2: number, y2: number, color: color, thickness: number)
x
number
X position.
y
number
Y position.
x2
number
Second X position.
y2
number
Second Y position.
color
color
Color of the line.
thickne
number
Thickness of the line.
draw.polygon(color: color, positions: {, ...})
color
color
Color of the polygon.
positions
vector
Screen positions.
draw.polyline(color: color, closed: boolean, thickness: number, positions: {, ...})
color
color
Color of the polygon.
closed
boolean
Connects the end to the beginning.
thickness
number
Thickness of the polyline.
positions
vector
Screen positions.
draw.rect(x: number, y: number, width: number, height: number, color: color[, thickness: number, rounding: number, rounding_corners: number])
x
number
X position.
y
number
Y position.
width
number
Width.
height
number
Height.
color
color
Color of the rectangle.
thickness
number
Optional. Thickness of the rectangle.
rounding
number
Optional. Rounding of the rectangle in pixels.
rounding_corners
number
draw.rect_filled(x: number, y: number, width: number, height: number, color: color[, rounding: number, rounding_corners: number])
x
number
X position.
y
number
Y position.
width
number
Width.
height
number
Height.
color
color
Color of the rectangle.
rounding
number
Optional. Rounding of the rectangle in pixels.
rounding_corners
number
draw.gradient(x: number, y: number, width: number, height: number, first_color: color, second_color[, type: number])
x
number
X position.
y
number
Y position.
width
number
Width.
height
number
Height.
first_color
color
First color.
second_color
color
Second color.
type
number
Optional. 0
- horizontal, 1
- vertical.
draw.circle(x: number, y: number, points: number, radius: number, color: color)
x
number
X position.
y
number
Y position.
points
number
Points of the circle.
radius
number
Radius of the circle.
color
color
Color of the circle.
draw.circle_filled(x: number, y: number, points: number, radius: number, color: color)
x
number
X position.
y
number
Y position.
points
number
Points of the circle.
radius
number
Radius of the circle.
color
color
Color of the circle.
draw.circle_glow(x: number, y: number, radius: number, color: color)
x
number
X position.
y
number
Y position.
radius
number
Radius of the circle.
color
color
Color of the circle.
draw.arc(x: number, y: number, radius: number, second_radius: number, min: number, max: number, color: color)
x
number
X position.
y
number
Y position.
radius
number
Radius of the circle.
second_radius
number
Second radius of the circle.
min
number
Minimum value.
max
number
Maximum value.
color
color
Color of the arc.
draw.circle_3d(position: vector, radius: number, color: color)
position
vector
Screen position.
radius
number
Radius of the circle.
colorgs
color
Color of the circle.
draw.circle_filled_3d(position: vector, radius: number, color: color)
position
vector
Screen position.
radius
number
Radius of the circle.
colorgs
color
Color of the circle.
draw.string(font: font_object, x: number, y: number, color: color, text: string[, shadow: boolean, outline: boolean])
font
font_object
Font.
x
number
X position.
y
number
Y position.
color
color
Color of the text.
text
string
Text that will be drawn.
shadow
boolean
Optional. Text shadow.
outline
boolean
Optional. Text outline.
draw.gradient_string(font: font_object, x: number, y: number, color: color, second_color: color, text: string, smooth: number[, shadow: boolean, outline: boolean])
font
font_object
Font.
x
number
X position.
y
number
Y position.
color
color
Color of the text.
second_color
color
Second color of the text.
text
string
Text that will be drawn.
smooth
number
Smoothness of the gradient.
shadow
boolean
Optional. Text shadow.
outline
boolean
Optional. Text outline.
draw.image_uv(texture: texture, position: vector, size: vector, display_min: vector, display_size: vector, texture_size: vector, color: color[, rounding: number])
texture
texture
Texture.
position
vector
Position.
size
vector
Size.
display_min
vector
None.
second_color
number
None.
color
color
Color of the image.
rounding
number
Optional. Image rounding.
draw.image_quad(texture: texture, pos1: vector_2d, pos2: vector_2d, pos3: vector_2d, pos4: vector_2d[, color: color, rounding: number])
texture
texture
Texture.
pos1
vector_2d
First position.
pos2
vector_2d
Second position.
pos3
vector_2d
Third position.
pos4
vector_2d
Fourth position.
color
color
Optional. Color of the image.
rounding
number
Optional. Image rounding.
draw.image(texture: texture, x: number, y: number, width: number, height: number, color: color[, rounding: number])
texture
texture
Texture.
x
number
X position.
y
number
y position.
width
number
Width.
height
number
Height.
color
color
Color of the image.
rounding
number
Optional. Image rounding.
draw.shadow(x: number, y: number, width: number, height: number, length: number, color: color[, x_offset: number, y_offset: number])
x
number
X position.
y
number
y position.
width
number
Width.
height
number
Height.
length
number
Shadow length.
color
color
Color of the shadow.
x_offset
number
Optional. X offset.
y_offset
number
Optional. Y offset.
draw.push_clip_rect(x: number, y: number, width: number, height: number)
x
number
X position.
y
number
y position.
width
number
Width.
height
number
Height.
Applies the clip region to the given rectangle for all subsequent elements.
draw.pop_clip_rect()
Discards an early set rectangle clipping region.
.
Optional. Rounds off certain corners.
Optional. Rounds off certain corners. .
Render any text via the or function.
Render any text via the or function.