A different approach would be to use a single sheet:
Code: Select all
Window* sheet = winMgr.createWindow("DefaultWindow", "root_wnd");
System::getSingleton().setGUISheet(sheet);
Load each layout, which I'm assuming contains each window you want to preload:
Code: Select all
Window* guiLayout = winMgr.loadWindowLayout("MyLayout.layout");
Hide the window:
Code: Select all
CEGUI::WindowManager::getSingleton().getWindow("Window Name")->setVisible(true);
Then add the window to the layout:
With this approach you only have to call setVisible() with
true to display a window and
false to hide it. Well, this approach should work. The only bit I'm unsure is hiding the window before adding it to the sheet.
The difficulty with having a .layout per window is that the Layout Editor automatically creates a root DefaultWindow for you, which breaks the rule that the name of each window must be unique (each layout tries to create a window called root). To fix this I used to manually edit the .layout file to remove that root window but there is supposed to be a way to export a portion of a layout, which would accomplish the same task.