Skip to content

Renderer

Functions

Return Type Name Description
nil gui.push_clip(vec2 xy, vec2 wh) Push a clip rect
nil gui.pop_clip() Pop a clip rect
text gui.text(string text) Create a text object
rect gui.rect(vec2 xy, vec2 wh) Create a rect object
nil gui.circle(vec2 xy, number radius, color color, number? segments) Render a circle
nil gui.chevron(vec2 xy, number radius, color color) Render a chevron
vec2 gui.get_size(string text, number? override_scale, number? wrap) Get the size of text
nil gui.image(texture_data img, vec2 xy, vec2 wh, color color) Render an image
nil gui.rounded_image(texture_data img, vec2 xy, vec2 wh, color color, number? rounding, Rounding? flags) Render a rounded image
texture_data gui.load_image(string path) Load an image
keyframe_animator gui.animator() Create a keyframe_animator

Types

color

Property Name Description
number r R as an integer (0 to 255)
number g G as an integer (0 to 255)
number b B as an integer (0 to 255)
number rf R as a number (0.0 to 1.0)
number gf G as a number (0.0 to 1.0)
number bf B as a number (0.0 to 1.0)
Return Type Name Description
color color(number hex) Constructs a color from a hex color (0xFF0000FF)
color color(number r, number g, number b, number? a) Constructs a color (using integers, 0 to 255)
color color(number r, number g, number b, number? a) Constructs a color (using floats, 0.0 to 1.0)

keyframe

Property Name
vec2 position
number opacity
number scale

keyframe_animator

Property Name
keyframe current_frame
Return Type Name
keyframe frame(number percentage)
bool valid()
nil init(number time, number delay)
nil reset()
nil update(number delta)

texture_data

Property Name
vec2 scale
string name
string path
number crc

rect

Return Type Name Description
rect line() Render as a line, with xy being the start and wh being the end
rect filled() Render as filled
rect flags(Rounding flags) Set the rounding flags
rect color(color col) Set the color
rect outline(color col) Set the outline color
rect thickness(number thickness) Set the thickness of the outline
rect rounding(number rounding) Set the rounding amount
rect multicolors(color upr_left, color upr_right, color bot_right, color bot_left) Set the multiple colors
nil draw() Draw

text

Return Type Name Description
text position(vec2 pos)
text color(color col)
text justify(Justify justify)
text wrap(number w)
text shadow() Render with a shadow
text clip(vec2 xy, vec2 wh) Render inside of a clip rect
text outline_thickness(number t)
text outline(color c)
text override_scale(number r)
text box(color col)
text box_rounded() Render the box rounded
text box_rounding(number r)
text box_flags(Rounding flags)
text box_padding(vec2 padding)
text rotate(number angle) Set a rotation (in radians)
nil draw()

Examples

-- Drawing 
gui.rect(vec2(500.0, 100.0), vec2(700.0, 500.0))
  :rounding(4.0)
  :thickness(1.0)
  :color(color(20, 20, 20, 255))
  :outline(color(255, 255, 255, 30))
  :draw()

gui.text('Hello, world!')
  :position(vec2(100.0, 100.0))
  :color(color(200, 200, 200, 200))
  :override_scale(18.0)
  :justify(Justify.CENTER)
  :draw()