Skip to content

MGFX API Guide

This page stays at /API for older links. New readers should start with the runtime-specific guides:

Same API, Two Facades

lua
local mgfx = include("mgfx/init.lua")

mgfx.RoundedBoxEx(16, 16, 220, 48, {
    radius = 8,
    fill = mgfx.LinearGradient(0, 0, 1, 0, Color(80, 170, 255), Color(90, 220, 180)),
})
lux
import * as mgfx from "@lux/mgfx"

client fn drawPanel() {
  local draw = mgfx.api
  draw.roundedBoxEx(16, 16, 220, 48, {
    radius = 8,
    fill = draw.linearGradient(0, 0, 1, 0, Color(80, 170, 255), Color(90, 220, 180)),
  });
}

Plain GLua uses PascalCase names on the table returned by mgfx/init.lua. Lux uses lowerCamelCase names on mgfx.api.*. The renderer behavior and style fields are the same.

GLuaLux
mgfx.StartPanelmgfx.api.startPanel
mgfx.RoundedBoxExmgfx.api.roundedBoxEx
mgfx.ImageExmgfx.api.imageEx
mgfx.ProgressBarExmgfx.api.progressBarEx
mgfx.LinearGradientmgfx.api.linearGradient
mgfx.TextExmgfx.api.textEx

What To Read

NeedPage
Install and first draw call in a normal addonPlain GLua Quick Start
Install and first draw call in LuxLux Quick Start
Frame scope, Name / NameEx, style tablesCore Concepts
Shadow, glow, backdrop, patternsEffects
Exact signatures and fieldsAPI Reference
Hot path rules and performance tradeoffsPerformance Model
Shaderpack and packaging detailsShaders and Packaging

API Groups

AreaMain APIs
Frame scope and shared coverageStartPanel, EndPanel, StartScreen, EndScreen, PushClip, PopClip, Mask, Clip
Shapes and linesRoundedBoxEx, ChamferBoxEx, RegularPolyEx, PolyEx, LineEx, CircleEx, CapsuleEx
Images and per-image masksImageEx, IconEx, style.mask = {kind = ...}
HUD meters and sectorsProgressBarEx, SegmentBarEx, RingEx, ArcEx, SectorEx
TextText, TextEx, TextBoxEx, MeasureText, PrewarmText
Paint and transformsLinearGradient, RadialGradient, EllipticalRadialGradient, WornPattern, Transform, PointerTilt, GetCapabilities

MGFX is a renderer, not a UI framework. It does not own layout, input, focus, component lifecycle, animation state, or hit testing.