Hi.
After reading the tutorials, it seems to me that I have to know what set of windows I wan't to render, and then apply their top level window through setGUISheet.
The thing is, I don't have any GUI sheet that's going to be static for a whole level or anything, but merely I once in a while wan't to pop up a clickable button here, and show some text box there.
So what would be the right approach, at having some predefined windows, that all can be popped up and created runtime, without having a root window?
Thank you for helping.
[ANSWERED] Understanding of setGUISheet
Moderators: CEGUI MVP, CEGUI Team
[ANSWERED] Understanding of setGUISheet
Last edited by Excizted on Wed Feb 24, 2010 11:02, edited 1 time in total.
Re: Understanding of setGUISheet
Couple of possibilities come into my mind:
1) Have all the windows in the same layout, but only have those windows visible that you need at the moment. When you don't need them, set them to invisible again.
2) Separate layout files for each window. Layout files don't have to be loaded as a root element, so you can do stuff like this:
If you wanna get rid of a window you can either hide it or destroy it:
If you need to add two or more instances of the same window, you can do it by giving loadWindowLayout() function different name_prefix parameters. The drawback of loadWindowLayout() is that you have to read from the disk every time, though you could probably write some kind of custom resource provider that caches stuff.
3) Create all windows and set their properties manually.
1) Have all the windows in the same layout, but only have those windows visible that you need at the moment. When you don't need them, set them to invisible again.
2) Separate layout files for each window. Layout files don't have to be loaded as a root element, so you can do stuff like this:
Code: Select all
DefaultWindow* root = (DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");
System::getSingleton().setGUISheet(root);
Window *mybutton = winMgr.loadWindowLayout("mybutton.layout");
root->addChildWindow(mybutton);
If you wanna get rid of a window you can either hide it or destroy it:
Code: Select all
winMgr.destroyWindow(mybutton);
If you need to add two or more instances of the same window, you can do it by giving loadWindowLayout() function different name_prefix parameters. The drawback of loadWindowLayout() is that you have to read from the disk every time, though you could probably write some kind of custom resource provider that caches stuff.
3) Create all windows and set their properties manually.
Re: Understanding of setGUISheet
Thanks for your reply 
I like the possibility two, and probably will be going with that. Also, on my todo list is creation of a resourceprovider that integrates with my own huge resource system, so the disk thing shouldn't be an issue.
Actually, most of the windows, if not all, are created in code, so uh, won't even be loading .layout files anyway.
Didn't quite understand the third suggestion, but that doesn't matter, I seem to have figured out the possibilities.
Thanks again.

I like the possibility two, and probably will be going with that. Also, on my todo list is creation of a resourceprovider that integrates with my own huge resource system, so the disk thing shouldn't be an issue.
Actually, most of the windows, if not all, are created in code, so uh, won't even be loading .layout files anyway.
Didn't quite understand the third suggestion, but that doesn't matter, I seem to have figured out the possibilities.
Thanks again.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: [ANSWERED] Understanding of setGUISheet
The third suggestion basically amounts to creating everything in code, which you said you're already doing 
CE.

CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Who is online
Users browsing this forum: Majestic-12 [Bot] and 5 guests