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:



What has been happening so far…

February 2, 2009

It seems as if there haven’t been too many updates here lately. I’ve been quite distracted with studying and getting the simulation of multi body systems into my head. And by doing so I stumbled over a few quite amazing papers and dissertations that seem to cope pretty much everything you need to know for a fully fledged physics engine (assuming you have some spare time).

For example the dissertation of Brian Mirtich (which you should be able to download here or here) covers just about everything from advanced collision detection to collision response. Even the calculation of inertia tensors in 3D is contained and the appendix covers all the math basics such as quaternion arithmacy and a rigid body primer. The whole thing wheighs a bit over 250 pages and is freely available. It still requires a lot of math knowledge, but as a math major I hope I have enough knowledge.

The method he describes in his thesis is the so called impulse based simulation which is stated in contrast to analytical methods as they are used in David Baraffs papers (as far as I understand). Instead of trying to fulfill all constraints simultaneously, instead if a constraint is violated it applies an impulse to the constrained bodies so that the constraint stays fulfilled within the next integration time horizon.

A more recent version of Mirtich’ aproach can be found at the site of Jan Bender ( He also wrote a dissertation over impulse based simulation (however in German) which has less math in it. The best is: his code is available under the zlib license! There is also a lot of documentation in English available, so go check it out!

Oh, and of course I have not just been doing multi body simulation stuff. I was playing around with Blender already for a while to have a nice visualization for my thesis. And I finally made a model for a character in a game I have been planning already for ages. Now I added a little movement to the model. Here you have it:

Be nice, she is a little older (and my first animation). You can get the full resolution version here.