Skip to content

Widgets

Widget functions draw renderer-level controls: progress bars, segment bars, rings, arcs, and radial sectors.

Facade aliases: MGFX.ProgressBar, MGFX.ProgressBarEx, MGFX.SegmentBar, MGFX.SegmentBarEx, MGFX.Ring, MGFX.RingEx, MGFX.Arc, MGFX.ArcEx, MGFX.Sector, MGFX.SectorEx.

Scope

  • ringEx(cx, cy, radius, width, style) and arcEx(cx, cy, radius, width, startDeg, endDeg, style) keep thickness in geometry parameters.
  • sectorEx(cx, cy, innerRadius, outerRadius, startDeg, endDeg, style) is a true radial sector, not a thick arc.
  • Shape-local angular gradients are not the same as global conic gradients.

This Page

Function Reference

progressBar

lux
mgfx.api.progressBar(x, y, w, h, value, radius, track, fill, stroke = nil, strokeWidth = nil)

Draws a simple horizontal progress bar. value is clamped to 0..1.

progressBarEx

lux
mgfx.api.progressBarEx(x, y, w, h, value, style)

Advanced progress bar.

FieldDescription
radiusTrack and fill radius. Defaults near min(4, h * 0.5).
paddingInset between track and fill.
trackUnfilled track paint.
fillFilled paint.
stroke / strokeWidthOptional track stroke.
trackPattern / fillPatternPattern slots.
outerGlow / innerGlowExtra effects on fallback paths.
fxOptional {glow, sheen, marker, ticks} fast-path effect flags.

segmentBar

lux
mgfx.api.segmentBar(x, y, w, h, value, segments, fill, track)

Draws a segmented value bar for ammo, charges, perk points, or compact discrete meters.

segmentBarEx

lux
mgfx.api.segmentBarEx(x, y, w, h, value, style)

Advanced segmented bar.

FieldDescription
segmentsSegment count, clamped to a reasonable range.
gapPixel gap between segments.
radiusPer-segment radius.
background / backgroundRadiusOptional container behind all segments.
trackInactive segment paint.
fill / colorActive segment paint.
fillPattern / trackPatternPattern slots.
stroke / strokeWidthPer-segment stroke on fallback paths.

ring

lux
mgfx.api.ring(cx, cy, radius, width, fill)

Draws a simple full ring. radius is the outer radius and width is the band thickness.

ringEx

lux
mgfx.api.ringEx(cx, cy, radius, width, style)

Advanced ring with fill, stroke, pattern, glow, backdrop, and transform.

lux
mgfx.api.ringEx(cx, cy, 38, 7, {
  fill = mgfx.api.conicGradient(0.5, 0.5, 20, Color(80, 170, 255), Color(255, 210, 110)),
  outerGlow = { color = Color(80, 170, 255, 55), width = 12 },
})

arc

lux
mgfx.api.arc(cx, cy, radius, startDeg, endDeg, width, fill)

Draws a simple round-capped arc segment.

arcEx

lux
mgfx.api.arcEx(cx, cy, radius, width, startDeg, endDeg, style)

Advanced arc. Angles are in degrees. Use for gauges, progress arcs, circular ticks, and partial cooldown meters.

sector

lux
mgfx.api.sector(cx, cy, innerRadius, outerRadius, startDeg, endDeg, fill)

Draws a straight-edged radial sector. innerRadius = 0 makes a solid sector.

sectorEx

lux
mgfx.api.sectorEx(cx, cy, innerRadius, outerRadius, startDeg, endDeg, style)

Advanced sector. Use sectorRadialGradient and sectorAngularGradient for sector-local gradients.

lux
mgfx.api.sectorEx(cx, cy, 36, 92, -45, 45, {
  fill = mgfx.api.sectorAngularGradient(Color(80, 170, 255, 170), Color(255, 210, 110, 145)),
  stroke = Color(255, 255, 255, 36),
  strokeWidth = 1,
})

Back to detailed API index