GLUI for LWJGL

I was just browsing some GLUI code and was just wondering how you could write something like this for LWJGL. Without multithreaded callbacks you’re pretty much stuffed aren’t you?

Would it be possible to cache mouse clicks, keyboard entries etc and process them all in sequence to determine the current state of all the widgets (button pressed, drop-down dropped down etc), and to call the relevant action methods? Is this kind of buffering implemented currently?

(Incidentally, check out this gem from GLUI’s stdinc.h:

[quote] /***** Small value when we want to do a comparison to ‘close to zero’ *****/
#ifndef FUDGE
#define FUDGE .00001
#endif
[/quote]
Oh, brother…)

FUDGE is probably used for epsilon-equals methods, which are preferably to comparing floats and doubles directly. Its not really a hack, just an irregularity of floating point numbers.

My own Gui framework is comming along nicely, with windows that are now draggable, resizeable and can be hidden/shown. Just got a basic button as well, other widgets can wait for the time being (layout managers and scroll panes up next…) To avoid threading, I’ve basically hung all the behavoir off a few methods: reactToUser(), update() and render(). Then I just call each of these every frame to keep them updated with the current state of the mouse/keyboard. If a component needs to, it forwards the calls to the child components, or discards them.

Is there anything specific you need multithreaded callbacks for? Cas doesn’t seem to have had any problems either, the Gui stuff looks pretty sweet - I may have to bug him about his text displaying code, mine still has some annoying quirks… :-[

You don’t need threads to write games! They’re for IO. So they might come in handy for multiplayer or async resource loading but that’s about it…

Orangy, just check out SPGL on Sourceforge for text drawing. Basically I used Java2D to render everything nicely and figure out kerning pairs by drawing all possible combos of pairs of letters together and noting the offset. Then I bung the resulting image in a texture and use my own kerning and layout code having pinched all the metrics from Java2D.

BTW don’t go overboard with the GUI idea, just get the important widgets done. Resizing windows is probably not terribly useful (although of course really easy to do :slight_smile: ) I still haven’t done a text area edit control yet as it’s the hardest one but I currently don’t need it…

Cas :slight_smile:

Ah, the text method sounds similar to my code at the moment, i’ll have a look into it (although it could just be that a higher res texture would help, 256x256 for an entire ascii character set is perhaps pushing it slightly…)

Since the Gui widgets are going to be used for my level editor, resizing is pretty important. But as is I think all I really need is a scroll pane style thing and a couple of variations on buttons (radio, checkbox) and I’m set to start on the editor proper ;D