Render

render namespace

Enums

Font flagsRect roundingText alignmentEasings

Datatypes

color

render.color(255, 255, 255)render.color(255, 255, 255, 100)render.color("#FFFFFF")

r

number

red channel (0-255)

g

number

green channel (0-255)

b

number

blue channel (0-255)

a

number

alpha channel (0-255)

255

hex_code

string

hex color code

Returns:

Value

Datatype

table with rgba values

table

Table structure:

{ r, g, b, a }

esp_flag

render.esp_flag("some flag", render.color("#FFFFFF"))

text

string

flag to draw

color

color to draw

Fonts

create_font

render.create_font("smallest_pixel-7.ttf", 11, render.font_flag_outline)

font_path

string

path to font or name of font

size

number

font size

flags

font flag

0

from

number

minimum codepoint

0

to

number

maximum codepoint

255

Returns:

Value

Datatype

font id

number

create_font_gdi

render.create_font_gdi("Smallest pixel-7", 11, render.font_flag_outline)

font_path

string

path to font or name of font

size

number

font size

flags

font flag

0

from

number

minimum codepoint

0

to

number

maximum codepoint

255

Returns:

Value

Datatype

font id

number

create_font_stream

render.create_font_stream({0x1, ...}, 12)

bytes

table

table of bytes

size

number

font size

flags

font flag

0

from

number

minimum codepoint

0

to

number

maximum codepoint

255

Returns:

Value

Datatype

font id

number

get_text_size

​render.get_text_size(font, "String to measure")

font

number

font id from render.create_font

text

string

string to measure

Returns:

Value

Datatype

width

number

height

number

Textures

create_texture

render.create_texture("fatality/image.jpg")

texture_path

string

path to texture

Supported image formats:

  • JPEG

  • PNG

  • BMP

  • GIF (non-animated)

  • TGA

  • PSD

  • HDR

  • PIC

  • PNM (binary only)

Returns:

Value

Datatype

texture id

number

create_texture_bytes

render.create_texture_bytes(bytes, 20)

bytes

unsigned char*

array of bytes

size

number

texture size

Supported Image Formats:

  • JPEG

  • PNG

  • BMP

  • GIF (non-animated)

  • TGA

  • PSD

  • HDR

  • PIC

  • PNM (binary only)

Returns:

Value

Datatype

texture id

number

Note:

This function can only be used by utilizing the ffi library as it requires a byte array. One way to do such would be using ISteamUtils::GetImageRGBA.

create_texture_rgba

render.create_texture_rgba(bytes, 100, 100, row_stride)

bytes

unsigned char*

array of bytes

w

number

texture width

h

number

texture height

row_stride

number

number of bytes in each row (image width * 4)

Supported Image Formats:

  • JPEG

  • PNG

  • BMP

  • GIF (non-animated)

  • TGA

  • PSD

  • HDR

  • PIC

  • PNM (binary only)

Returns:

Value

Datatype

texture id

number

Note:

This function can only be used by utilizing the ffi library as it requires a byte array. One way to do such would be using ISteamUtils::GetImageRGBA.

create_texture_stream

render.create_texture_stream({0x1, 0x5, 0xff})

byte_stream

table of bytes

texture bytes

Returns:

Value

Datatype

texture id

number

create_texture_svg

local svg_data =[[<svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="#ffffff" d="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z" /></svg>]]render.create_texture_svg(svg_data, 20)-- orrender.create_texture_svg("fatality/image.svg", 20)

image

string

svg data or svg file path

target_height

number

desired image height

Returns:

Value

Datatype

texture id

number

push_texture

local texture_id = render.create_texture("image.png")render.push_texture(texture_id)

texture_id

number

texture id returned from render.create_texture

Usage:

Pushes a texture used by render functions.Make sure to follow the call with render.pop_texture!Failure to do so will result in undefined behavior!

pop_texture

render.pop_texture()

Usage:

Pops a previously used texture

push_uv

render.push_uv(0.25, 0.25, 0.75, 0.75)

x1

number

min x coord (0 - 1)

y1

number

min y coord (0 - 1)

x2

number

max x coord (0 - 1)

y2

number

max y coord (0 - 1)

Usage:

Adjusts texture coordinates. Use after calling render.push_texture.Make sure to follow the call with render.pop_uv!Failure to do so will result in undefined behavior!

pop_uv

render.pop_uv()

Usage:

Pops a previously used set of texture coordinates.

get_texture_size

​render.get_texture_size(texture_id)

texture_id

number

texture id from create_texture

Returns:

Value

Datatype

width

number

height

number

Drawing

push_clip_rect

render.push_clip_rect(10, 10, 110, 110)

x1

number

min x point

y1

number

min y point

x2

number

max x point

x2

number

max y point

intersect

boolean

should it intersect with existing clip rects

false

Usage:

Pushes a clip rect so elements can only be drawn within the rect.Make sure to follow the call with render.pop_clip_rect!Failure to do so will result in undefined behavior!

pop_clip_rect

render.pop_clip_rect()

Usage:

Pops a previously used clip rect

get_screen_size

render.get_screen_size()

Returns:

Value

Datatype

width

number

height

number

rect_filled

render.rect_filled(10, 10, 110, 110, render.color("#00FFFF"))

x1

number

min x point

y1

number

min y point

x2

number

max x point

y2

number

max y point

color

table

table of rgba values see render.color

Usage:

Draws a filled rectangle. Use render.push_texture to apply a texture to the shape.

rect

render.rect(10, 10, 110, 110, render.color("#00FFFF"))

x1

number

min x point

y1

number

min y point

x2

number

max x point

y2

number

max y point

color

table

table of rgba values see render.color

rect_filled_rounded

render.rect_filled_rounded(10, 10, 110, 110, render.color("#00FFFF"), 1.5, render.top)

x1

number

min x point

y1

number

min y point

x2

number

max x point

y2

number

max y point

color

table

table of rgba values see render.color

rounding

number

amount of rounding

rounding_flags

number

corners to round

Usage:

Draws a filled rounded rectangle. Use render.push_texture to apply a texture to the shape.

rect_filled_multicolor

render.rect_filled_multicolor(10, 10, 110, 110,render.color("#FFFFFF"), render.color("#000000"),render.color("#FFFFFF"), render.color("#000000"))

x1

number

min x point

y1

number

min y point

x2

number

max x point

y2

number

max y point

top_left

table

table of rgba values see render.color

top_right

table

table of rgba values see render.color

bottom_right

table

table of rgba values see render.color

bottom_left

table

table of rgba values see render.color

Usage:

Draws a multi-color rectangle.

circle_filled

render.circle_filled(110, 110, 50, render.color("#FFFFFF"))

x

number

center x point

y

number

center y point

radius

number

the circles radius

color

table

table of rgba values see render.color

segments

number

number of points (circle resolution)

12

percentage

number

how much of the circle is drawn (0 - 1)

1

angle

number

circle rotation (0 - 360Draws a filled multi-color rectangle.)

0

Usage:

Draws a filled circle. Use render.push_texture to apply a texture to the shape.

circle

render.circle(110, 110, 50, render.color("#FFFFFF"))

x

number

center x point

y

number

center y point

radius

number

the circles radius

color

table

table of rgba values see render.color

thickness

number

thickness of the circle in pixels

1

segments

number

number of points (circle resolution)

12

percentage

number

how much of the circle is drawn (0 - 1)

1

angle

number

circle rotation (0 - 360)

0

line

render.line(10, 10, 100, 100, render.color("#FFFFFF"))

x1

number

first x coord

y1

number

first y coord

x2

number

second x coord

y2

number

second y coord

color

table

table of rgba values see render.color

line_multicolor

render.line_multicolor(10, 10, 100, 100,render.color("#FFFFFF"), render.color("#000000"))

x1

number

first x coord

y1

number

first y coord

x2

number

second x coord

y2

number

second y coord

color

table

table of rgba values see render.color

color2

table

table of rgba values see render.color

triangle_filled

render.triangle_filled(20, 10, 5, 20, 30, 20, render.color("#FFFFFF"))

x1

number

first x coord

y1

number

first y coord

x2

number

second x coord

y2

number

second y coord

x3

number

third x coord

y3

number

third y coord

color

table

table of rgba values see render.color

Usage:

Draws a filled triangle. Use render.push_texture to apply a texture to the shape.

triangle

render.triangle(20, 10, 5, 20, 30, 20, render.color("#FFFFFF"))

x1

number

first x coord

y1

number

first y coord

x2

number

second x coord

y2

number

second y coord

x3

number

third x coord

y3

number

third y coord

color

table

table of rgba values see render.color

triangle_filled_multicolor

render.triangle_filled_multicolor(20, 10, 5, 20, 30, 20,render.color("#FF0000"), render.color("#00FF00"), render.color("#0000FF"))

x1

number

first x coord

y1

number

first y coord

x2

number

second x coord

y2

number

second y coord

x3

number

third x coord

y3

number

third y coord

color1

table

table of rgba values see render.color

color2

table

table of rgba values see render.color

color3

table

table of rgba values see render.color

text

render.text(font, 10, 10, "this is some centered text", render.color("#FFFFFF"), render.align_center, render.align_center))

font

number

font id(see render.create_font)

x

number

first x coord

y

number

first y coord

text

string

text to draw

color

table

table of rgba values see render.color

align_horizontal

number

horizontal alignment type

align_vertical

number

vertical alignment type

Pre-defined fonts:

  • font_tab

  • font_control

  • font_esp

  • font_indicator

-- Ex: render.font_tab, render.font_control

Animations

create_animator_float

render.create_animator_float(0, 5, render.ease_in_out)

initial_value

color

starting value

duration

number

how long to take in seconds

easing_type

the animation type

Returns:

Value

Datatype

animator object

animator

create_animator_color

render.create_animator_float(render.color("FFFFFF"), 5, render.ease_in_out, true)

initial_value

color

starting value

duration

number

how long to take in seconds

easing_type

the animation type

interpolate_hue

boolean

should the hue be animated

false

Returns:

Value

Datatype

animator object

animator

Last updated