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!
GUI Strategy
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
I could probably write up some code if necessary, but that should probably give you the idea.
Travis
Modular Gui and Lua
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
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
-
- Posts: 13
- Joined: Wed Feb 14, 2007 3:32 pm
- Location: HH | Germany
- Contact:
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.
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.
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)
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.
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 ); }
}
in the onevent i call a for loop wich calls from every menu opend a OnEvent function.
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
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.
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.
I load the gui in the begin of the game and store them in those menu classes.Midnight wrote:what in the hell for?
we already have 3 but without a good skin...Midnight wrote:many creatures.. which aren't even in the game!!
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99