GLIMGUI released

March 26, 2014

Ages ago I wrote a nice article about how I searched for a simple GUI system for a game that I was working at the time. I ended up writing my own GUI system that was using the IMGUI approach and I am still very happy with this. It indirectly inspired @the_vrld to create Quickie which is an IMGUI system for my favourite 2D game framework LÖVE.

In the article I had written that I plan to release a simple library that can be used as a starting point for more advanced IMGUI explorations. Turns out I never did publish it so here we go:

Grab the code from:

It is licensed under the MIT license and as said very basic but with ~500 lines it should also be very easy to adjust and extend it. It is written in plain C and only depends on OpenGL and glut. Only ASCII strings are supported but if you have a fully featured unicode rendering function available it should be very easy to plug it in (look at glimgui_printxy(float x, float y, const char str*, ...)).

Here are some screenshots (very basic but easy-peasy to pimp): main_menu options

And here the full source code for the UI including the button logic that was used for the screenshots:

void draw_ui () {
  glimgui_prepare ();

  // Drawing of the GUI

  // We have two GUIs that are indicated by the global gui_layout value
  if (gui_layout == 0) {
    glimgui_label (99, "Main Menu", 20, 20, 1, 1); 

    if (glimgui_button (1, "Some Button", 220, 100, 180, 50)) {
      printf ("Some Button was pressed!\n");

    if (glimgui_button (2, "Options", 220, 180, 180, 50)) {
      gui_layout = 1;
      printf ("Switching to Options!\n");

    if (glimgui_button (3, "Quit", 220, 380, 180, 50)) {
      printf ("Quit!\n");
  } else {
    glimgui_label (99, "Options", 20, 20, 1, 1); 

    if (glimgui_button (1, "Some Other Button", 220, 100, 180, 50)) {
      printf ("Some Other Button was pressed!\n");

    glimgui_label (98, "Enter your name:", 150, 180, 1, 50);

    static char name[32] = { "IMGUI fan\0" };

    if (glimgui_lineedit (2, name, 16, 290, 195, -1, 20)) {
      printf ("Changed name value: '%s'\n", name);

    glimgui_label (97, "Enter your age:", 150, 210, 1, 50);

    static char age[32] = { "99\0" };

    if (glimgui_lineedit (3, age, 3, 290, 225, -1, 20)) {
      printf ("Changed age value: '%s'\n", age);

    if (glimgui_button (4, "Back", 220, 380, 180, 50)) {
      printf ("Switching back!\n");
      gui_layout = 0;

  glimgui_finish ();

Nice, ey?


code snippet: luatables simple access to lua tables from C/C++

June 5, 2012

The last two gamejams definitely convinced me that Lua is a very elegant, fast and easy to learn scripting language. Combined with the amazing LÖVE engine really cool things can happen.

When I created on my simple skeletal animation tool MeshUp, I thought that using JSON as a fileformat would be way better than XML as it is not as verbose and therefore easier to read. Also there is a nice C++ library for reading and writing JSON files.

However the syntax of JSON is actually fairly similar to Lua so I thought it would be a nice thing to have scripting powers in the model description files as it empowers you to even … script repetitive tasks!!!

The only problem was that the interface to get values from Lua into C can be a little counter intuitive as one has to interact with Lua through its stack. I do have to not here that the Lua stack is – just as the language itself – a very elegant way for passing data in and out of Lua’s virtual machine. But as said before it is not as intuitive when one wants to do simple things.

For this I hacked together a small set of functions, called luatables, that should simplify using Lua as a fileformat. There are of course various libraries already available, but I wanted a) get to know Lua a bit better and b) have a lightweight solution that does not add bloat or dependencies.

I published it under the (very permissive) zlib open-source license. You can grab it from:



Rigid Body Dynamics Library

December 7, 2011

Hi there…

some time ago, I posted a video about my C++ implementation of the Articulated Body Algorithm (ABA), one of the best available algorithms available to perform forward dynamics computations on kinematic tree structures (if this sounds weird, replace “forward dynamics computations” by “physics simulations” and “kinematic tree structures” by “human-like figures” and you might be able to get a clue what you can do with it).

I mostly use it for my scientific work, which is funded by the Heidelberg Graduate School of Mathematical  and Computational Methods for the Sciences. I spent quite some time in programming it and making sure it does what it should (91 tests!).

Some highlights:

So far I am very happy with it and thought that maybe other can benefit from it as well.

Therefore I decided to publish it under an open-source license, namely the very permissive zlib license (which is also used by Bullet), which should allow pretty much anyone to do what he/she/it wants with it. However comments, suggestions or acknowledgements are still very welcome.

You can grab it at:

It does feel a little weird to let it out into the wild, but I hope it is of use for anyone.