Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.
It has come to my attention that I have not been particularly clear about how usable or feature-complete libui is, and that this has fooled many people into expecting more from libui right this moment than I have explicitly promised to make available. I apologize for not doing this sooner.
libui is currently mid-alpha software. Much of what is currently present runs stabily enough for the examples and perhaps some small programs to work, but the stability is still a work-in-progress, much of what is already there is not feature-complete, some of it will be buggy on certain platforms, and there's a lot of stuff missing. In short, here's a list of features that I would like to add to libui, but that aren't in yet:
In addition, here is a list of issues generalizing existing problems.
Furthermore, libui is not properly fully documented yet. This is mainly due to the fact that the API was initially unstable enough so as to result in rewriting documentation multiple times, in addition to me not being happy with really any existing C code documentation tool. That being said, I have started to pin down my ideal code documentation style in parts of
ui.h, most notably in the uiAttributedString APIs. Over time, I plan on extending this to the rest of the headers. You can also use the documentation for libui's Go bindings as a reference, though it is somewhat stale and not optimally written.
But libui is not dead; I am working on it whenever I can, and I hope to get it to a point of real quality soon!
Note that today's entry (Eastern Time) may be updated later today.
7 April 2019
1 September 2018
uiImageAppend()not working as documented. It now works properly, with one important difference you'll need to care about: it now requires image data to be alpha-premultiplied. In addition,
uiImagealso is implemented slightly more nicely now, and
ui.hhas minor documentation typo fixes.
10 August 2018
8 August 2018
uiImage, and a new control,
uiTable, for displaying tabular data. These provide enough basic functionality for now, but will be improved over time. You can read the documentation for the new features as they are here. Thanks to everyone who helped get to this point, in particular @bcampbell for the initial Windows code, and to everyone else for their patience!
30 May 2018
16 May 2018
13 May 2018
uiDateTimePickerOnChanged(). These operate on standard
struct tms. Thanks @cody271!
12 May 2018
2 May 2018
libui.resfile with static builds. You do need to link in the appropriate manifest file, such as the one in the
windows/folder (I still need to figure out exactly what is needed apart from the Common Controls v6 dependency, or at least to create a complete-ish template), or at least include it alongside your executables. This also means you should no longer see random cmake errors when building the static libraries.
18 April 2018
uiTimer()function for running code on a timer on the main thread. (Thanks to @cody271.)
common/directory to use
uiprivprefixes for everything that isn't
static. This is the first step toward fixing static library oddities within libui, allowing libui to truly be safely used as either a static library or a shared library.
18 March 2018
drawtext, which shows the whole API at a glance. It doesn't yet support measuring or manipulating text, nor does it currently support functions that would be necessary for things like text editors; all of this will be added back later.
CONTRIBUTING.mdfor details. They are still WIP.
17 February 2018
Old announcements can be found in the NEWS.md file.
va_copy()) — you can build either a static or a shared library
libui uses only the standard Meson build options, so a libui build can be set up just like any other:
$ # you must be in the top-level libui directory, otherwise this won't work $ meson setup build [options] $ ninja -C build
Once this completes, everything will be under
build/meson-out/. (Note that unlike the previous build processes, everything is built by default, including tests and examples.)
The most important options are:
--buildtype=(debug|release|...)controls the type of build made; the default is
debug. For a full list of valid values, consult the Meson documentation.
--default-library=(shared|static)controls whether libui is built as a shared library or a static library; the default is
shared. You currently cannot specify
both, as the build process changes depending on the target type (though I am willing to look into changing things if at all possible).
-Db_sanitize=whichallows enabling the chosen sanitizer on a system that supports sanitizers. The list of supported values is in the Meson documentation.
--backend=backendallows using the specified
backendfor builds instead of
ninja(the default). A list of supported values is in the Meson documentation.
Most other built-in options will work, though keep in mind there are a handful of options that cannot be overridden because libui depends on them holding a specific value; if you do override these, though, libui will warn you when you run
The Meson website and documentation has more in-depth usage instructions.
For the sake of completeness, I should note that the default value of
flat, not the usual
mirror. This is done both to make creating the release archives easier as well as to reduce the chance that shared library builds will fail to start on Windows because the DLL is in another directory. You can always specify this manually if you want.
Backends other than
ninjashould work, but are untested by me.
Meson also supports installing from source; if you use Ninja, just do
$ ninja -C build install
--prefixoption will set the installation prefix. The Meson documentation has more information, and even lists more fine-grained options that you can use to control the installation.
Can be built from AUR: https://aur.archlinux.org/packages/libui-git/
Needs to be written. Consult
ui.hand the examples for details for now.
libui was originally written as part of my package ui for Go. Now that libui is separate, package ui has become a binding to libui. As such, package ui is the only official binding.
Other people have made bindings to other languages:
|C# / .NET Framework||LibUI.Binding|
|C# / .NET Core||DevZH.UI, SharpUI, TCD.UI|
|D||DerelictLibui (flat API), libuid (object-oriented)|
|Lua||libuilua, libui-lua, lui, lui|
OS X normally does not start program executables directly; instead, it uses Launch Services to coordinate the launching of the program between the various parts of the system and the loading of info from an .app bundle. One of these coordination tasks is responsible for bringing a newly launched app into the foreground. This is called "activation".
When you run a binary directly from the Terminal, however, you are running it directly, not through Launch Services. Therefore, the program starts in the background, because no one told it to activate! Now, it turns out there is an API that we can use to force our app to be activated. But if we use it, then we'd be trampling over Launch Services, which already knows whether it should activate or not. Therefore, libui does not step over Launch Services, at the cost of requiring an extra user step if running directly from the command line.