Tuesday, July 10, 2007

IMGUI

The development of Flippuzzle is moving on smoothly and the menus looks a lot nicer and cleaner today than they did three days ago. I've put quite a lot of work into getting rid of all unnecessary menus. Earlier the player had to pass through four different screens to start a new game, now two is enough to fire it up.

I've been using the IMGUI desgin pattern for my menus, this is something that have worked really well, and that's why I'd like to tell you a few words about it.

IMGUI stands for Immediate Mode Graphical User Interface. The idea is to let the rendering and logic for the GUI melt together. This reduces needs for callbacks and event handling and therefore removes a lot of the awkward parts of GUI coding.

Button example:
if( DrawButton( "ok", 25, 25 ) )
{
//the button was clicked..
DoSomething();
}

Besides the improved readability, this makes sure you don't have to initialize/cleanup all your buttons. Just render, check for action and forget. Nice and simple.

I'm really pleased with this system. It's fast to create and edit menus and they can be as dynamic as you like them to. I recommend using IMGUI, especially when the amount of menus is quite small. The bottom line: it's ideal for most games.

For more information about IMGUI check out Casey Muratori's video on the subject at Molly Rocket.

No comments: