RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
Loading...
Searching...
No Matches
RMGui documentation

Latest public release: v0.14.4 (ABI 14)

RMGui is a C11 UI library for an application that already owns its window and event loop. Start with one control in a rectangle you supply; add retained layout when the screen needs it.

Draw your first frame

Install the library and run the meters example. It writes a software frame without a window. Then take the button from the four illustrated C examples and drive it from your event loop:

  1. Own the host. Keep the window, event loop, framebuffer, assets and element state in your application. RMGui updates the state and paints; it does not poll events, open windows or present pixels.
  2. Initialize once. Match the headers and archive and check the ABI at startup. Allocate the RGBA8 destination with rmgui_fb_alloc. Keep a zero-initialized button across frames, initialize a font from trusted bytes for its label, and start with the immutable built-in style.
  3. Route input. Pick a button rectangle in framebuffer pixels. Send pointer events to the hit control or the one holding capture, and keys and text to the focused control. Apply results such as activation to your application. See input, editing and gestures.
  4. Style the control. In current source, put the theme, font and scale in an rmgui_ui_t shared across controls. Typed draw calls resolve the style for the current state. The released examples spell out that step with rmgui_style_resolve. See style, skins and recipes.
  5. Paint and track damage. Repaint the whole framebuffer to start. With retained layout, arrange changes to publish geometry and damage; clip scene painting to the damage regions. Redraw the background and overlapping elements there, not just the control that changed. Include damage from any paint or animation changes you manage outside the layout tree.
  6. Present. Copy or upload the finished pixels to the window or canvas. Update just the damaged regions if the presentation surface preserves the rest. See rendering and images for software, recorded and GPU targets.

Choose an element

  • Actions and values. Use a button to trigger a command, a toggle for an on/off setting, a slider for a bounded value, or a spin box when the value also needs precise typing. See typed elements for the common drawing API in current source.
  • Text and pickers. Use a field for editable text, a combo for a searchable set of choices, and a date or color picker for structured values. Use rich text for selectable, formatted reading content.
  • Lists and data views. Use an individual list row for a hand-built list. For large collections, use an indexed model with a virtual list, a tree for a hierarchy, or a table for sortable columns.
  • Panels and commands. Use a splitter for resizable panes or docking to rearrange workspace panels. Use tabs to switch views and a toolbar or menubar to surface commands.
  • Status and visualization. Use progress for completion, a tooltip for an in-place hint, or a toast for transient feedback. Use a sparkline for a compact trend or combine a plot with axes.

The modules and elements guide explains storage and state for composed widgets, dashboard controls and indexed models. Try them in the showcase, or give them motion and property animation.

Look up a contract

Use Public API contracts to find headers by task. Use Doxygen’s Files and Data Structures for the complete generated reference: declarations, type fields, units and lifetimes.

To build the reference locally, run mkdir -p build && make docs and open build/docs/html/index.html. See the source build guide or the project site assembly guide.