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.
| GLua | Lux |
|---|---|
mgfx.StartPanel | mgfx.api.startPanel |
mgfx.RoundedBoxEx | mgfx.api.roundedBoxEx |
mgfx.ImageEx | mgfx.api.imageEx |
mgfx.ProgressBarEx | mgfx.api.progressBarEx |
mgfx.LinearGradient | mgfx.api.linearGradient |
mgfx.TextEx | mgfx.api.textEx |
What To Read
| Need | Page |
|---|---|
| Install and first draw call in a normal addon | Plain GLua Quick Start |
| Install and first draw call in Lux | Lux Quick Start |
Frame scope, Name / NameEx, style tables | Core Concepts |
| Shadow, glow, backdrop, patterns | Effects |
| Exact signatures and fields | API Reference |
| Hot path rules and performance tradeoffs | Performance Model |
| Shaderpack and packaging details | Shaders and Packaging |
API Groups
| Area | Main APIs |
|---|---|
| Frame scope and shared coverage | StartPanel, EndPanel, StartScreen, EndScreen, PushClip, PopClip, Mask, Clip |
| Shapes and lines | RoundedBoxEx, ChamferBoxEx, RegularPolyEx, PolyEx, LineEx, CircleEx, CapsuleEx |
| Images and per-image masks | ImageEx, IconEx, style.mask = {kind = ...} |
| HUD meters and sectors | ProgressBarEx, SegmentBarEx, RingEx, ArcEx, SectorEx |
| Text | Text, TextEx, TextBoxEx, MeasureText, PrewarmText |
| Paint and transforms | LinearGradient, 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.