Multiple Sheets at one time?

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
arkos
Quite a regular
Quite a regular
Posts: 49
Joined: Thu Apr 27, 2006 21:45

Multiple Sheets at one time?

Postby arkos » Mon Jun 05, 2006 05:53

Hey guys,

is it possible to have multiple CEGUI sheets running at one time? As my game stands now, I can only have 1 menu up at a time so when the player opens the pause menu, the HUD or main menu disappears. I switch the sheets with

Code: Select all

mGUISystem->setGUISheet(menuArr[curMenu].menuSheet);


where menuArr is a data struct that I wrote which holds the sheets. I couldn't find anything on the forum although I seem to remember reading about someone who had multiple sheets running. Thanks

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Jun 05, 2006 15:03

So far I've always used a FrameWindow to contain my widgets. I suspect that you create a layout that contains widgets on their own. What about placing them on a "special" FrameWindow, one that does not have a title bar nor a frame and a transparent background? This way you could simply hide the FrameWindow to make your buttons disappear, and not have to deal with multiple sheets.

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Mon Jun 05, 2006 23:40

or just use a DefaultWindow
No point in the FrameWindow when all its features are disabled

User avatar
arkos
Quite a regular
Quite a regular
Posts: 49
Joined: Thu Apr 27, 2006 21:45

Postby arkos » Tue Jun 06, 2006 17:40

thanks for the reply guys.

I definately see the value in your way, but I have already put a great deal of effort into creating these different sheet files with the layout editor. I suppose I could cut and paste into one .layout file (putting each sheet into one default window) and then load that into the editor. The real tediousness is having to switch the visible bool in the editor each time I want to change a different pseudo sheet (the top most sheet will always be selected unless it is not visible). Maybe I will eventually break down and do it the way you suggest. :D Thanks again for your help.

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Tue Jun 06, 2006 20:17

You do not have to reload everything into a single .layout file. Myself I'm placing one dialog/FrameWindow per .layout file and loading each one after the other (I mean loading them all at once rather than loading one, using it, then unloading it in order to load a different one).

The only gotcha that I have to deal with is that by default the Layout Editor v0.41 (or is it v0.4.1?) creates a root DefaultWindow; I have to delete it and replace it with my FrameWindow. The reason I have to delete it is that window names must be unique, so when I load two .layout there's a name conflict; I'm basically telling CEGUI to load the "root" window twice.

User avatar
arkos
Quite a regular
Quite a regular
Posts: 49
Joined: Thu Apr 27, 2006 21:45

Postby arkos » Wed Jun 07, 2006 02:53

ok,

I think I am missing something. In my code I do:

Code: Select all

menuArr[MAIN_MENU].menuSheet = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"main_menu.layout");
   menuArr[CHAR_MENU].menuSheet = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"char_menu.layout");
   menuArr[COURSE_MENU].menuSheet = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"course_menu.layout");
   menuArr[OPTIONS_MENU].menuSheet = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"options_menu.layout");
   menuArr[PAUSE_MENU].menuSheet = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"pause_menu.layout");
   menuArr[HUD_MENU].menuSheet = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"hud_menu.layout");
   


and then switch between sheets. With your method do you just call something like:

Code: Select all

CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"main_menu.layout");


and then that loads all of the windows into a default sheet and you do this for all the other .layout files?

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Wed Jun 07, 2006 13:13

I do not have access to my code from work so this is taken from Sample_FalagardDemo1.cpp:

System::getSingleton().setGUISheet(background);
background->addChildWindow(winMgr.loadWindowLayout("../datafiles/layouts/VanillaWindows.layout"));

With multiple .layout files I would do:

System::getSingleton().setGUISheet(background);
Window* window = winMgr.loadWindowLayout("../datafiles/layouts/Dialog_1.layout");
window->setVisible(false);
background->addChildWindow(window );

window = winMgr.loadWindowLayout("../datafiles/layouts/Dialog_2.layout");
window->setVisible(false);
background->addChildWindow(window );

window = winMgr.loadWindowLayout("../datafiles/layouts/Dialog_3.layout");
window->setVisible(false);
background->addChildWindow(window );

This works for me because each .layout contains a FrameWindow. I'm not sure how it would work if the .layout contained buttons.

User avatar
Dalfy
CEGUI Team (Retired)
Posts: 130
Joined: Tue Oct 11, 2005 16:13
Location: Paris, FRANCE
Contact:

Postby Dalfy » Thu Jun 08, 2006 11:54

Exactly the same I think. A FrameWindow and a Button are both Window and the core of CEGUI handle a tree of Window object.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 5 guests