Live data from Hacker News

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

github.com

31–40 of 91 posts

Re: MicroUI – A tiny, portable, immediate-mode UI library written in ANSI C

#31

I wrote a little demo to run microui on top of the sokol headers here, it's really interesting in how minimal it is. WASM demo: https://floooh.github.io/sokol-html5/sgl-microui-sapp.html Source code: https://github.com/floooh/sokol-samples/blob/master/sapp/sgl... The renderer backend is just a bunch of C functions you need to provide: https://github.com/floooh/sokol-samples/blob/3f4185a8578cd2b... It's also interesti…

pretty nifty but im trying to figure out what the use case for this is when its aimed at hobbyists ?

I use pygtk and dont have to fiddle with lower level stuff

Re: MicroUI – A tiny, portable, immediate-mode UI library written in ANSI C

#32
post #4

Nice, except the hard part seems to be missing: interfacing with an actual window system (X11, TUI, WIN32, whatever ...)

It's a "bring your own renderer" UI framework, just like Dear ImGui or Nuklear. In some situation (e.g. when adding debugging UIs to a game) this is actually a big advantage compared to the renderer being baked into the library, since the game already has a renderer subsystem which the UI can easily hook into.

Re: MicroUI – A tiny, portable, immediate-mode UI library written in ANSI C

#33
post #5

The first thing I look for in any UI library is accessibility support. Makes it trivial to filter out toy projects.

I agree, and the lack of empathy around this area is sad. If you're developing an app, it is better to fall into the pit of success by using a UI framework that already has accessibility baked in. Any project that uses Dear Imgui for end-user applications has already made a bad design choice. AccessKit (https://accesskit.dev/) seems to be a positive step forward, with some UI frameworks implemented (including immediate mode egui).

Re: MicroUI – A tiny, portable, immediate-mode UI library written in ANSI C

#34
post #3

Immediate-mode in pure C is a nice constraint. how does it handle text rendering, do you bring your own atlas or is there something built in? Thats usually the part that balloons the dependency footprint.

The demo uses a simple prebuilt fixed-size font atlas texture and renders the entire UI (including character quads) via batched glDrawElements calls (one draw call per clip-rect).

But the way how text rendering is delegated to the user is quite flexible, microui basically calls these three user-provided functions:

    int r_get_text_height(void)
    int r_get_text_width(const char* text, int len);
    void r_draw_text(const char* text, mu_Vec2 pos, mu_Color color);
...how r_draw_text() is implemented is then entirely up to you.

Re: MicroUI – A tiny, portable, immediate-mode UI library written in ANSI C

#35

I wrote a little demo to run microui on top of the sokol headers here, it's really interesting in how minimal it is. WASM demo: https://floooh.github.io/sokol-html5/sgl-microui-sapp.html Source code: https://github.com/floooh/sokol-samples/blob/master/sapp/sgl... The renderer backend is just a bunch of C functions you need to provide: https://github.com/floooh/sokol-samples/blob/3f4185a8578cd2b... It's also interesti…

pretty nifty but im trying to figure out what the use case for this is when its aimed at hobbyists ? I use pygtk and dont have to fiddle with lower level stuff

Minimal debugging/controller overlays for games would be the most obvious use case (e.g. similar to dat.gui for web).

Re: MicroUI – A tiny, portable, immediate-mode UI library written in ANSI C

#36

Earlier quoted context omitted.

"Accessibility" is an open-ended set of functionality, not a checkbox; it is never "complete", there is always room for improvement. Colorblind support (which ones)? High-Contrast mode? Adjustable text size? Screenreader integration? Localization? IME support? Keyboard navigation? Keyboard remapping? Functional entirely without a keyboard? Touch support? Pen support? Dyslexia-aiding typefaces? The list goes on and on…

This is one of the reasons why web technology is so popular and persistent. You get almost all of that for free as long as you use semantic HTML.

Which nobody uses

Re: MicroUI – A tiny, portable, immediate-mode UI library written in ANSI C

#37
I used this one in 2022 to make a proof of concept for a build once / run anywhere graphical app and IIRC the library was quite nice, even if a bit limited. The resulting kludge is at https://github.com/jacereda/cosmogfx and there's a prebuilt binary that should run on Linux, Windows and some BSDs. https://github.com/jacereda/cosmogfx/releases/download/v0.0....

Cosmopolitan Libc has since integrated the bits to make OpenGL work in cross-platform binaries and it's awesome.

Re: MicroUI – A tiny, portable, immediate-mode UI library written in ANSI C

#39
post #24
post #5

The first thing I look for in any UI library is accessibility support. Makes it trivial to filter out toy projects.

Not very smart. I would go further and say that even full unicode support could be avoided and a software can still be massively useful. It is sad that the world is so hung up on unicode and things like accessibility that we all have to submit to the tyranny of browser layers!

> sad that the world is so hung up on unicode

It is sad that the world is hung up on enabling 2/3rds of the world population to read and write text! If only the entire world catered to America. Nobody should ever speak anything other than English, honestly.

Post reply on HN