Git for the orangehattech website https://orangehattech.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cgui.md 6.8KB

C Gui Libraries

So you’ve decided to code a GUI in C. That’s probably a horrible decision. But hey, I’ve made that horrible decision a bunch of times myself, so I can help!

This document has a lot of my own biases in it, and I haven’t used most of the tools I’m writing about. I’d recommend that you do your own research before coming to strong conclusions. This document is a starting point, not an ending point.

LGPL is listed as a negative. This is because most people who care about a library being LGPL care because they have to avoid LGPL’d code. (Usually for static linking with closed source software)


Cross platform libraries


Code once, use everywhere. Generally “Everywhere” in this context is Windows, Linux, BSD, and OSX. Android apps have a complicated relationship with C code, and I don’t know much about them.

Nuklear

I’ve used this library extensively. It’s my personal favorite.

  • Simple to use
  • Extremely flexible
  • Can render via opengl2/3, sdl, allegro, x11(lin), d3d(win), and gdi(win).
  • Can be used to create GUIs inside existing rendering contexts.
  • Public Domain licensed
  • Requires the use of a separate context-creation library.
  • Everything is implemented in a single monolithic header file.
  • Doesn't provide a native look and feel on any platform

Libui

I haven’t yet used this.

  • Provides a native look and feel.
  • MIT Licensed
  • Can’t be used to render to existing contexts

IUP

I’ve used this library.

  • Cross platform
  • Code once, use everywhere. Except Mac.
  • Provides a native look and feel.
  • Doesn’t run on OSX.

LibAgar

I’ve used this, but ran into a breaking bug that I couldn’t fix and the author didn’t seem interested in fixing.

  • Can be used to create GUIs inside existing rendering contexts.

GTK+

I haven’t used this directly.

  • Arguably the closest equivalent Linux has to a native GUI toolkit.
  • LGPL license - No static compilation with arbitrarily licensed software
  • Can't be used to render to existing contexts
  • Difficult to utilize outside of Linux. (Partially due to LGPL licensing)

c-imgui

I haven’t used this.

  • MIT Licensed
  • Can be used to create GUIs inside existing rendering contexts.
  • Wrapper for a C++ project.
  • Doesn't provide a native look and feel on any platform

LCUI

I haven’t used this and I can’t imagine how it could possibly work.

  • MIT Licensed
  • Doesn't provide a native look and feel on any platform

Tinyfiledialogs

I’ve used this. It was ok.

  • ZLIB/PNG Licensed
  • Only exposes a few pre-made dialogs
  • Everything is implemented in a single monolithic header file.

Boksi

I made this. It’s ok. It uses many of the libraries listed on this page to do its thing.

  • MIT Licensed
  • Extremely small, due to its use of dynamic loading to find an appropriate library.
  • Only exposes an error box style dialog.
  • Not particularly mature codebase.
  • Dev is kinda funny looking.

Raygui

I haven’t used this yet

  • Zlib Licensed

Tk

I haven’t used this.

  • Requires the use of an uncommon language (TCL) to specify the gui.
  • Can't be used to render to existing contexts

WxC

An effort to expose WxWidgets to C.

  • Last updated in 2013

XVT

  • Provides a native look and feel.
  • Allows visual editing of GUIs.
  • Crazy expensive. Wow. Wow so crazy expensive. Just buy a car instead.
  • Closed source software

Single platform libraries


You’ll need to code a separate solution for each targeted platform. Worth considering if you only need to target a single platform for whatever reason.

Win32 libs

I haven’t used this directly.

  • Windows only
  • Native library
  • Windows is probably the world's most popular OS, for reasons beyond the ken of mortal man
  • Can't be used to render to existing contexts

Xaw

I’ve used this library lightly.

  • Linux/X11 only
  • Easy to use
  • Generally considered outdated

Motif

I don’t have experience with this one.

  • Linux/X11 only
  • Generally considered outdated

XForms

I don’t have experience with this one.

  • Linux/X11 Only
  • Allows visual editing of GUIs.
  • LGPL


Similar libraries


Sometimes you’re doing something weird, and you need lower level access than most GUI libraries will provide. Don’t worry, you can always roll you own!

Oh, and on a personal note? 9 times out of 10, you’re making a mistake somewhere if you’re looking at these libraries. It’s extremely likely that you can use something else to get a better result with less coding.

XLib

I don’t have experience with this one.

  • Linux/X11 only
  • Generally considered outdated: XCB is preferred for modern applications.

XCB

I don’t have experience with this one. Modern replacement for XLib

  • Linux/X11 only

Xt

I don’t have experience with this one. Built on xlib. Powers XAW and Motif.

  • Linux/X11 only
  • Generally considered outdated

GDK

I don’t have direct experience with this one.

  • Powers GTK+
  • Linux/X11 only
  • LGPL

NanoVG

I’ve used this. Stands for Nano Vector Graphics.

  • Cross platform
  • Small
  • Easy to use
  • Fast
  • Many back ends
  • Exposes access to vector graphics
  • Low level