RMGui
Retained UI for games and interactive media, in C11. Build layouts that stay put, animate the parts that should move, and keep your own game loop. Paint into an RGBA8 framebuffer or record draw commands for a host renderer.
Get v0.14.4 · Read the docs · Open the live showcase
Examples
These C snippets use a host-supplied framebuffer, geometry and fonts. Read the documentation for setup and storage requirements.
Drag across the code or use Shift with the arrow keys to select. Right-click for Copy text, or press Ctrl+C or Command+C. Use the snippet’s scrollbars to see more code.
Reward HUD
Click or tap a card, or focus the HUD and use the arrow keys and Enter. The locked card shakes; equipping the others charges the meter and sends confetti out from behind the card.
// Ask the track to post a burst event at the end of the pop.
cue.event_id = (uint32_t)item;
cue.burst = points ? &burst : NULL;
cue.burst_count = points ? BURST_EDGES * COUNT(burst_sixteenths) : 0;
if (rmgui_tracks_play(&h->tracks, &cue, 1, RMGUI_TRACK_PARALLEL,
&h->playing[item])) return -1;
// In the track event handler, emit across all four edges.
if (event->burst && !h->reduced)
emit_card_burst(h, (int)event->event_id, event);Open the HUD with repaint counters · Download the C example · See Motion tracks in the showcase
Slider
Drag the slider or use the arrow keys after focusing it.
const int64_t detents[] = {25, 50, 75};
rmgui_style_resolved_t style;
if (rmgui_style_resolve(theme, RMGUI_STYLE_CLASS_SLIDER, slider->states,
17, 100, &style) != 0)
return -1;
rmgui_slider_paint(fb, &style, box, clip, slider, detents, 3);Chart
Hover or tap to inspect a sample, or focus the chart and use the arrow keys.
if (!rmgui_chart_series_count(series)) {
const int32_t samples[] = {12, 32, 24, 61, 53, 78, 68};
rmgui_chart_series_init(series, slots, 7);
for (uint32_t i = 0; i < 7; ++i) {
if (rmgui_chart_series_push(series, i * 1000, samples[i]) != 0)
return -1;
}
}
rmgui_chart_plot_samples(fb, box, clip, view, chart_style, series, 0,
RMGUI_CHART_PLOT_AREA);
rmgui_chart_axis_paint(fb, box, clip, view, chart_style, font, 13);Rich text
Read Hamlet’s “To be, or not to be” soliloquy. Drag to select the verse, or scroll with the wheel, scrollbar, or Page Up and Page Down.
if (!rich->layout) {
if (rmgui_richtext_markdown(markdown, markdown_len, style->font_px, parsed))
return -1;
if (rmgui_richtext_layout(NULL, &parsed->document, fonts, style,
box.w, layout))
return -1;
if (rmgui_richtext_init(rich, layout) != 0)
return -1;
}
rmgui_richtext_paint(fb, rich, box, clip, NULL, NULL);Explore the full showcase · Download a complete C example
Download v0.14.4 (ABI 14)
Static library, C headers and target-specific link flags:
Release notes, desktop demos and other packages · SHA-256 checksums