A tiny immediate-mode UI library; rxi (2018).
npm install microui.c1100 sloc of ANSI C
bash
$ npm i microui.c
`
And then include microui.h as follows:
`c
// main.c
#define MICROUI_IMPLEMENTATION
#include
int main() { / ... / }
`
Finally, compile while adding the path node_modules/microui.c to your compiler's include paths.
`bash
$ clang -I./node_modules/microui.c main.c # or, use gcc
$ gcc -I./node_modules/microui.c main.c
`
You may also use a simpler approach with the cpoach tool, which automatically adds the necessary include paths of all the installed dependencies for your project.
`bash
$ cpoach clang main.c # or, use gcc
$ cpoach gcc main.c
`
Example
!example
`c
if (mu_begin_window(ctx, "My Window", mu_rect(10, 10, 140, 86))) {
mu_layout_row(ctx, 2, (int[]) { 60, -1 }, 0);
mu_label(ctx, "First:");
if (mu_button(ctx, "Button1")) {
printf("Button1 pressed\n");
}
mu_label(ctx, "Second:");
if (mu_button(ctx, "Button2")) {
mu_open_popup(ctx, "My Popup");
}
if (mu_begin_popup(ctx, "My Popup")) {
mu_label(ctx, "Hello world!");
mu_end_popup(ctx);
}
mu_end_window(ctx);
}
`
Screenshot
!screenshot
Browser Demo
Usage
* See doc/usage.md for usage instructions
* See the demo` directory for a usage example