Pick your runtime first
Plain GLua projects include mgfx/init.lua and keep its returned API local. Lux projects import @lux/mgfx and use mgfx.api.*.
Shader-backed immediate rendering for Garry's Mod UI. Start with your runtime, then use the same renderer concepts for shapes, images, meters, text effects, gradients, masks, glow, and backdrop blur.
local mgfx = include("mgfx/init.lua")
function PANEL:Paint(w, h)
mgfx.StartPanel(self, w, h)
mgfx.RoundedBoxEx(0, 0, w, h, {
radius = 10,
fill = Color(8, 14, 20, 170),
backdrop = {blur = 8, tint = Color(0, 8, 12, 120)},
outerGlow = {color = Color(70, 205, 255, 64), width = 12},
})
mgfx.ProgressBarEx(24, 84, w - 48, 10, 0.72, {
radius = 5,
track = Color(10, 18, 24, 190),
fill = mgfx.LinearGradient(0, 0, 1, 0, Color(30, 130, 255), Color(255, 210, 110)),
})
mgfx.EndPanel()
endimport * as mgfx from "@lux/mgfx"
fn PANEL:Paint(w, h) {
local draw = mgfx.api
draw.startPanel(self, w, h)
draw.roundedBoxEx(0, 0, w, h, {
radius = 10,
fill = Color(8, 14, 20, 170),
backdrop = {blur = 8, tint = Color(0, 8, 12, 120)},
outerGlow = {color = Color(70, 205, 255, 64), width = 12},
})
draw.progressBarEx(24, 84, w - 48, 10, 0.72, {
radius = 5,
track = Color(10, 18, 24, 190),
fill = draw.linearGradient(0, 0, 1, 0, Color(30, 130, 255), Color(255, 210, 110)),
})
draw.endPanel();
}MGFX is a renderer, not a UI framework. It does not own layout, input, focus, component lifecycle, transition state, or hit testing. Callers compute the current visual state every frame and pass explicit draw arguments to the Plain GLua API table or mgfx.api.*.
Plain labels should usually use native GMod text or Text. Use TextEx only when you need shader text effects such as gradient faces, glow, stroke, or high-quality shadow.
docs-site/ by hand. Update docs/ and rebuild the site.