Home > Programming > I’m Still Here

I’m Still Here

March 17, 2009

It’s been a long time since my last post, I know, shame on me! It’s all for a good reason though, really. I’ve been working on prototyping a new UI library for a program that I’m working on. One thing that I’ve been trying to get around is all the code that is required in UI programming. During my searching I came across some IMGUI, or immediate mode GUI techniques. Somewhat interesting, but I found no real implementation details on how to solve some of the harder problems with doing GUIs this way.

One of the major benefits is that instead of having to have some setup code for your UI, then some event hookup code, and then having your UI render magically, you make a direct call, like this:

if (ks::Button(ks::Rect(10, 10, 75, 25), “Click Me”) {
// returns true if the button was clicked, false otherwise

We put this code in our update loop and voila, every frame we get a button drawn and we handle the event right there instead of some semi-complicated event handling structure.

The jury is still out, but so far it’s been fairly promising. One of the hard problems to solve though is how to uniquely identify a control from frame to frame. This problem doesn’t occur in a normal UI because the object exists from frame to frame, and I don’t want to write code that looks like this:

if (ks::Button(“button1”, ks::Rect(10, 10, 75, 20), “Click Me”) {


if (ks::Button(ks::GenerateUid(), ks::Rect(10, 10, 75, 20), “Click Me”) {

My current strategy is to generate the UID on the call based on the bounding rect information. This is potentially problematic if the button moves or for things like sliders and scroll bars, so we’ll see if it works.

Well, that’s all of my rambling for now. πŸ™‚

Categories: Programming
%d bloggers like this: