πŸ—ΊοΈdraw

world_to_screen

draw.world_to_screen(position: vector): vector

Name
Type
Description

position

vector

Position in world space.

Returns the screen position vector. This can only be called from the on_paint callback.

create_font

draw.create_font(name: string, size: number, flags: number): font_object

Name
Type
Description

name

string

Font that will be initialized.

size

number

Size of the font.

flags

number

Returns the font_object struct or nil on failure.

create_weapon_font

draw.create_weapon_font(size: number): font_object

Name
Type
Description

size

number

Size of the font.

Returns the font_object struct or nil on failure.

create_texture

draw.create_texture(path: string): texture

Name
Type
Description

path

string

Path to the image.

Returns the texture or nil on failure.

get_text_size

draw.get_text_size(font: font_object, text: string): vector

Name
Type
Description

font

font_object

Font.

text

string

Text from which the size will be obtained.

Returns the size of the text.

structures

πŸ”— font_object

size

font.size: number

drawing

blur

draw.blur(x: number, y: number: width: number, height: number, alpha: number)

Name
Type
Description

x

number

X position.

y

number

Y position.

width

number

Width.

height

number

Height.

alpha

number

Alpha.

line

draw.line(x: number, y: number, x2: number, y2: number, color: color, thickness: number)

Name
Type
Description

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.

polygon

draw.polygon(color: color, positions: {, ...})

Name
Type
Description

color

color

Color of the polygon.

positions

vector

Screen positions.

polyline

draw.polyline(color: color, closed: boolean, thickness: number, positions: {, ...})

Name
Type
Description

color

color

Color of the polygon.

closed

boolean

Connects the end to the beginning.

thickness

number

Thickness of the polyline.

positions

vector

Screen positions.

rect

draw.rect(x: number, y: number, width: number, height: number, color: color[, thickness: number, rounding: number, rounding_corners: number])

Name
Type
Description

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

Optional. Rounds off certain corners. rounding

rect_filled

draw.rect_filled(x: number, y: number, width: number, height: number, color: color[, rounding: number, rounding_corners: number])

Name
Type
Description

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

Optional. Rounds off certain corners. rounding.

gradient

draw.gradient(x: number, y: number, width: number, height: number, first_color: color, second_color[, type: number])

Name
Type
Description

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.

circle

draw.circle(x: number, y: number, points: number, radius: number, color: color)

Name
Type
Description

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.

circle_filled

draw.circle_filled(x: number, y: number, points: number, radius: number, color: color)

Name
Type
Description

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.

circle_glow

draw.circle_glow(x: number, y: number, radius: number, color: color)

Name
Type
Description

x

number

X position.

y

number

Y position.

radius

number

Radius of the circle.

color

color

Color of the circle.

arc

draw.arc(x: number, y: number, radius: number, second_radius: number, min: number, max: number, color: color)

Name
Type
Description

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.

circle_3d

draw.circle_3d(position: vector, radius: number, color: color)

Name
Type
Description

position

vector

Screen position.

radius

number

Radius of the circle.

colorgs

color

Color of the circle.

circle_filled_3d

draw.circle_filled_3d(position: vector, radius: number, color: color)

Name
Type
Description

position

vector

Screen position.

radius

number

Radius of the circle.

colorgs

color

Color of the circle.

string

Render any text via the create_font or create_weapon_font function.

draw.string(font: font_object, x: number, y: number, color: color, text: string[, shadow: boolean, outline: boolean])

Name
Type
Description

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.

gradient_string

Render any text via the create_font or create_weapon_font function.

draw.gradient_string(font: font_object, x: number, y: number, color: color, second_color: color, text: string, smooth: number[, shadow: boolean, outline: boolean])

Name
Type
Description

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.

image_uv

draw.image_uv(texture: texture, position: vector, size: vector, display_min: vector, display_size: vector, texture_size: vector, color: color[, rounding: number])

Name
Type
Description

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.

image_quad

draw.image_quad(texture: texture, pos1: vector_2d, pos2: vector_2d, pos3: vector_2d, pos4: vector_2d[, color: color, rounding: number])

Name
Type
Description

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.

image

draw.image(texture: texture, x: number, y: number, width: number, height: number, color: color[, rounding: number])

Name
Type
Description

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.

shadow

draw.shadow(x: number, y: number, width: number, height: number, length: number, color: color[, x_offset: number, y_offset: number])

Name
Type
Description

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.

push_clip_rect

draw.push_clip_rect(x: number, y: number, width: number, height: number)

Name
Type
Description

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.

pop_clip_rect

draw.pop_clip_rect()

Discards an early set rectangle clipping region.

Last updated