✏ïļRender

render namespace

Enums

Font flags

font_flag_shadow

font_flag_outline

Rect rounding

top_left

top_right

bottom_left

bottom_right

top

left

bottom

right

all

Rect outline

outline_inset

outline_outset

outline_center

Text alignment

align_top

align_left

align_center

align_right

align_bottom

Easings
  • linear

  • ease_in

  • ease_out

  • ease_in_out

  • elastic_in

  • elastic_out

  • elastic_in_out

  • bounce_in

  • bounce_out

  • bounce_in_out

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:

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

0

to

number

255

Returns:

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

0

to

number

255

Returns:

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

0

to

number

255

Returns:

font id

number

get_text_size

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

font

number

text

string

string to measure

Returns:

width

number

height

number

wrap_text

render.wrap_text(font, 'This is a really long string!', 250)

font

number

text

string

string to measure

width

number

target text width

Returns:

text

string

text

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

font

number

font id

❌

x

number

first x coord

❌

y

number

first y coord

❌

text

string

text to draw

❌

color

table

❌

align_horizontal

number

horizontal alignment type

align_vertical

number

vertical alignment type

align_line

number

multiline alignment type

Pre-defined fonts:

  • font_gui_main

  • font_gui_title

  • font_gui_bold

  • font_esp

  • font_esp_name

  • font_indicator

-- Ex: render.font_gui_main, render.font_esp

Shaders

create_shader

local shader = render.create_shader([[
    sampler s0;

    float4 main(float2 uv: TEXCOORD0): COLOR0
    {
        return tex2D(s0, uv);
    }
]]);

src

string

shader source code

Supported pre-defined shader parameters:

Register

Type

s0

sampler

current texture

c0

float2

current texture's dimensions

c1

float

current time in seconds

c2

float

current global alpha override

Returns:

shader id

number

set_shader

render.set_shader(shader);

shader_id

number / nil

shader id returned from render.create_shader

Usage:

Sets or resets a shader.

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:

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:

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:

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:

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)
-- or
render.create_texture_svg("fatality/image.svg", 20)

image

string

svg data or svg file path

target_height

number

desired image height

Returns:

texture id

number

push_texture / set_texture

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

texture_id

number

texture id returned from render.create_texture

Pre-defined textures:

  • texture_logo_head

  • texture_logo_stripes

  • texture_cursor

  • texture_loading

  • texture_icon_up

  • texture_icon_down

  • texture_icon_clear

  • texture_icon_copy

  • texture_icon_pase

  • texture_icon_add

  • texture_icon_search

  • texture_icon_settings

  • texture_icon_bug

  • texture_icon_rage

  • texture_icon_legit

  • texture_icon_visuals

  • texture_icon_misc

  • texture_icon_scripts

  • texture_icon_skins

  • texture_avatar

-- Ex: render.texture_logo_head, render.texture_avatar

Usage:

Sets a texture used by render functions.

pop_texture

render.pop_texture()

Usage:

Pops a previously used texture

push_uv / set_uv

render.set_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.

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

Returns:

width

number

height

number

get_frame_count

local framecount = render.get_frame_count(my_gif)

texture_id

number

Returns:

framecount

number

This function will return 0 if a texture is NOT an animated GIF.

Drawing

get_screen_size

local w, h = render.get_screen_size()

Returns:

width

number

height

number

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

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

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

❌

thickness

float

thickness of line

1.f

outline

number

outline type

rect_rounded

render.rect_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

❌

rounding

number

amount of rounding

❌

rounding_flags

number

corners to round

thickness

float

thickness of line

1.f

outline

number

outline type

Usage:

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

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

❌

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

top_right

table

bottom_right

table

bottom_left

table

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

❌

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

❌

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

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

color2

table

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

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

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

color2

table

color3

table

Animations

create_animator_float

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

initial_value

starting value

❌

duration

number

how long to take in seconds

❌

easing_type

the animation type

Returns:

animator object

create_animator_color

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

initial_value

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:

animator object

Last updated