Skip to content

Repository files navigation

muForge

A tiny, customizable immediate-mode UI fork of microui.

muForge is based on microui 2.02 by rxi. I started the fork because the upstream project had become inactive and contributions were no longer being maintained. I wanted to keep the original two-file C library, then improve it without turning it into a framework.

The core stays small, renderer-independent, allocation-free during normal use, and easy to embed. The long-term work is focused on deeper customization, portability, correctness, and performance.

Status

muForge is currently an early fork baseline.

Already present:

  • Renamed muf_ and MUF_ API
  • Direct C and C++ inclusion
  • CMake targets, presets, installation, and package exports
  • MSVC, GCC, and Clang development configurations
  • Core behavior tests and a C++ smoke test
  • SDL2/OpenGL demo

The larger API and rendering changes are still in development.

Direction

  • Public primitives for building custom controls with the same layout, input, clipping, ID, and state machinery used by built-in controls
  • A more flexible drawing command layer for custom visuals and renderer-specific work
  • Safer command storage, capacity handling, assertions, and cross-architecture behavior
  • Less redundant work in text measurement and rendering
  • Configurable memory limits and reduced hosted-runtime assumptions
  • Compile testing across MSVC, GCC, Clang, ARM, RISC-V, and other targets
  • An optional muForge++ wrapper for projects that prefer a modern C++ interface over the smallest possible integration

muForge++ will remain separate. The C core is still the primary library.

Integration

Copy these two files into your project:

src/muforge.c
src/muforge.h

Compile muforge.c as C and include the header:

#include "muforge.h"

The application supplies input, text measurement, and rendering. muForge emits a command buffer and does not depend on a windowing system or graphics API.

C++ code can include the header directly:

#include "muforge.h"

CMake

add_subdirectory(external/muforge)
target_link_libraries(app PRIVATE muforge::muforge)

The library target has no external dependencies. SDL2 is used only by the demo.

Example

if (muf_begin_window(ctx, "Example", muf_rect(10, 10, 220, 130))) {
  int widths[] = { 60, -1 };

  muf_layout_row(ctx, 2, widths, 0);

  muf_label(ctx, "First:");
  if (muf_button(ctx, "Button 1")) {
    printf("Button 1 pressed\n");
  }

  muf_label(ctx, "Second:");
  if (muf_button(ctx, "Button 2")) {
    muf_open_popup(ctx, "Example Popup");
  }

  if (muf_begin_popup(ctx, "Example Popup")) {
    muf_label(ctx, "Hello world!");
    muf_end_popup(ctx);
  }

  muf_end_window(ctx);
}

Development

muForge is primarily developed with Visual Studio. The CMake project has also been tested with VS Code, CLion, and direct command-line builds using the provided presets and workflow commands. No editor-specific project format is required.

cmake --workflow --preset windows-msvc-debug
cmake --workflow --preset linux-gcc-debug
cmake --workflow --preset linux-clang-debug
cmake --workflow --preset linux-clang-sanitize

Credits

muForge is a fork of microui, originally written by rxi.

The original control API, layout system, container model, ID handling, fixed-memory design, and command-buffer architecture come from microui. Derived source files retain rxi's copyright and MIT license notice.

License

MIT. See LICENSE.

About

A tiny, customizable immediate-mode UI fork of microui

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages