Angluca / mui

microui, a tiny immediate-mode ui library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

microui

A tiny, portable, immediate-mode UI library written in ANSI C

Copy rxi/microui
Use it with nim language :)

Features

  • Tiny: around 1100 sloc of ANSI C
  • Works within a fixed-sized memory region: no additional memory is allocated
  • Built-in controls: window, scrollable panel, button, slider, textbox, label, checkbox, wordwrapped text
  • Works with any rendering system that can draw rectangles and text
  • Designed to allow the user to easily add custom controls
  • Simple layout system

Installation

nimble install # or nimble install mui
nimble test

Example

example

#if ctx.begin_window("My Window", mu.Rect(x:10, y:10, w:140, h:86))!=0:
if ctx.begin_window("My Window", mu.rect(10, 10, 140, 86))!=0:
  ctx.layout_row(2, [60.cint, -1], 0)

  ctx.label("First:")
  if button(ctx, "Button1")!=0: # c call func
    echo "Button1 pressed"

  ctx.label("Second:")
  if ctx.button("Button2")!=0: # OOP call func
    ctx.open_popup("My Popup")

  if ctx.begin_popup("My Popup")!=0:
    ctx.label("Hello world!")
    ctx.end_popup()

  ctx.end_window()

Screenshot

screenshot

Browser Demo

Usage

  • See the demo directory for a usage example

Notes

The library expects the user to provide input and handle the resultant drawing commands, it does not do any drawing itself.

Contributing

The library is designed to be lightweight, providing a foundation to which you can easily add custom controls and UI elements; pull requests adding additional features will likely not be merged. Bug reports are welcome.

License

This library is free software; you can redistribute it and/or modify it under the terms of the MIT license. See LICENSE for details.

About

microui, a tiny immediate-mode ui library

License:MIT License


Languages

Language:Nim 85.0%Language:C 15.0%