GUI Strategy

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
inbuninbu
Posts: 8
Joined: Mon Feb 05, 2007 12:12 am

GUI Strategy

Post by inbuninbu »

The tutorial is a good demonstration of how gui stuff works in irrlicht, but what about larger-scale design?

For example, the way I started to do it was to set up all gui stuff beforehand, and make things visibile/invisible in response to user actions. However, it looks like this is not how it is supposed to happen in irrlicht. For one thing, when you close a window, the window is deleted.

So I guess my question is... how are you supposed to manage your GUI tree? Are you really supposed to call guienv->addFoo() all the time?

Thanks in advance!
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

So far the best thing I've seen for a GUI management using Irrlicht is a state machine. When a state is entered, the gui elements are all placed and loaded up. Each state can respond to key and mouse events on its own, and when an event comes along that changes the state, the current state is exited and it cleans up everything it created. The UI becomes very modular, with each bit of the state machine managing the UI that it presents.

I could probably write up some code if necessary, but that should probably give you the idea.

Travis
inbuninbu
Posts: 8
Joined: Mon Feb 05, 2007 12:12 am

Post by inbuninbu »

Sorry for the delay.

Thanks, I think that was what I needed. I'll be experimenting a bit.
Gordie
Posts: 1
Joined: Mon Feb 19, 2007 1:18 pm
Location: Scotland
Contact:

Modular Gui and Lua

Post by Gordie »

Hi,

If you aren't already familiar with the scripting language LUA, then I suggest taking a look at it.

Basically I'd say that this is an excellent Job to use LUA for.

In short you wrap up the long winded repetative stuff in LUA then call stuff from script.. you don't have to recompile and you can hand the task to an artist or a designer to create the interface without risking any damage to your codebase.

Think of your LUA calls as your own API.

I'm a Lua fan, I'm always looking for LUA related solutions to things I see on forums.

http://www.lua.org/

Cheers,

Gordie
Plan it, Engineer it, Break It, Fix it, release it
atomhamster
Posts: 13
Joined: Wed Feb 14, 2007 3:32 pm
Location: HH | Germany
Contact:

Post by atomhamster »

offtopic (but maybe Gordie was offtopic also): i dont see, how lua will help and why do artists know lua?
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

the current state of irrlicht gui is this.

state machine/scene or environment manager.

the gui has many new functions in the svn build everything from scalable to positional alignment.

the most impressive addition is serialization which allows for guiSave() and guiLoad ( not sure of actual syntax) which allows you to easily construct a gui set in the editor thats now bundled aswell.

so the idea here is that you load and unload gui xml files depending on your current scene needs.
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

i build a some sort of scenenode gui interface,

template gui menu
- onevent
- build
- remove

so i make a class
class CMenuWeapon : public CMenu

and call in a controller
addMenu(num)

Code: Select all

void addMenu(int id)
{
    if (id == 1)
   {
       CMenu_wapon = new CMenuWeapon();
       CMenu_wapon->build();
       list_menu.push_back((CMenu*)CMenu_wapon );   }
}
and in a remove function i search for the menu id and removes it out of the list and gui env.

in the onevent i call a for loop wich calls from every menu opend a OnEvent function.
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

what in the hell for?

btw your mythorgia video is the funniest poop I've ever seen.

huge cities.. a whole block size!!

different land scapes.. with the same exact trampled looking grass!!

many creatures.. which aren't even in the game!!

ok just joking around infact your game looks to be farther along then anything else I've seen really in that catagory.

BTW your space project has elements I was planning for my own game and sounds like a cool idea.
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

Midnight wrote:what in the hell for?
I load the gui in the begin of the game and store them in those menu classes.
Midnight wrote:many creatures.. which aren't even in the game!!
we already have 3 :shock: but without a good skin...
Post Reply