GUI Libraries

Blitz3D Forums/Blitz3D Programming/GUI Libraries

podperson(Posted 2003) [#1]
I've been looking at all kinds of GUI libraries different people have written for Blitz3D. Some have editors, some don't. Some are sprite-based co-existing with your 3D world, others have their own, while yet others draw on the screen directly. Yada yada yada.

But they all seem to have some really annoying features in common:

You need to poll controls directly in your code.

I.e. they pollute your main event loop.

Has anyone written a control library where, at least in theory, you can:

1) Instance the controls (once) -- preferably using a resource file created with a GUI interface editor.
2) Call Update_GUI() once in your main event loop.

And everything just works?

There's one obvious obstacle to getting this working completely: how do you make a control do something?

Well suppose you have a routine called DoConsoleCommand(Command$) that does whatever you like based on Command$ (like a console, of course -- indeed, this would be the same backend your console uses). It should be possible to attach commands to controls when you instance them (e.g. attach a command to a control's MouseUp event).

(The one ugly side of this is that you need to write DoConsoleCommand yourself or your library won't run.)

The reason I'm asking this, is that if someone has written such a library, I'd rather use it than write one from scratch. Otherwise, I'll continue working on my own GUI library.


TartanTangerine (was Indiepath)(Posted 2003) [#2]
Yeah, My GUI Lib does this (actually a menu system for games), you just call it once every loop with UpdateGUI() and any action is passed back to the main loop via a global variable. Since every GUI Object has a unique ID it is therefore possible (using the Select command) to do actions when buttons are pressed etc.

Since this was designed with Menu's in mind some of the buttons provide links into other menus, provide resolution selection etc.. these actions are all controlled within the UpdateGUI() call. The lib also takes care of text input and chat boxes etc.

The set-up of the menu system is also very simple. You don't have to code it in the main program, all of the setting for buttons are contained within .txt files which determine the look and feel of buttons, size, position, justification, action, ID, Font, Text, ToolTips etc...

This system gives a great deal of flexibilty when using different languages since the all buttons etc.. are created when you initilaise the lib (created on the fly and saved into memory). You just choose which .txt file to parse and the buttons are created for you..

I'm not ready to release it yet since I'ts a ongoing development alongside a game I am working on.. But watch this space.


podperson(Posted 2003) [#3]
Sounds great. The bare bones system in my game will probsbly be somewhat less elaborate, but is designed along similar principles. Hope to hear more about your lib when it's done...