[ANSWERED] Understanding of setGUISheet

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Excizted
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Tue Feb 23, 2010 22:16

[ANSWERED] Understanding of setGUISheet

Postby Excizted » Tue Feb 23, 2010 22:23

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.
Last edited by Excizted on Wed Feb 24, 2010 11:02, edited 1 time in total.

Timo
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Sun Feb 14, 2010 09:38

Re: Understanding of setGUISheet

Postby Timo » Wed Feb 24, 2010 03:00

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:

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.

Excizted
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Tue Feb 23, 2010 22:16

Re: Understanding of setGUISheet

Postby Excizted » Wed Feb 24, 2010 11:01

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.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: [ANSWERED] Understanding of setGUISheet

Postby CrazyEddie » Wed Feb 24, 2010 11:41

The third suggestion basically amounts to creating everything in code, which you said you're already doing :)

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 18 guests