Problem closing window

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

User avatar
mikachu
Just popping in
Just popping in
Posts: 4
Joined: Fri Jan 13, 2006 20:00

Problem closing window

Postby mikachu » Thu Dec 28, 2006 23:57

Hi all,
For my game, I pre-load several windows and pre-bind each button.
Then, I use

Code: Select all

mGUISystem->setGUISheet(mySheet);

to show a window (only one window is shown at a time).
I use

Code: Select all

mGUISystem->setGUISheet(0);

to hide the window.

It's working, but the problem is that "sometimes" the windows doesn't get closed. It seems that the bug appears only when the mouse isn't over a button (In my game, I can manually close the ingame menu by pressing escape key)

Am I completely wrong with my method? Or did I miss something?

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

Postby Rackle » Fri Dec 29, 2006 02:31

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:

Code: Select all

sheet->addChildWindow(guiLayout);


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.

User avatar
mikachu
Just popping in
Just popping in
Posts: 4
Joined: Fri Jan 13, 2006 20:00

Postby mikachu » Fri Dec 29, 2006 08:43

Thank you for the tip, I'll try it right now.
As for the CELayoutEditor problem, I knew about it, and I have already renamed all my windows in layouts. Right now, I'm creating layouts manually, with lots of copy/paste, and I find it as fast as using CELayoutEditor..


Return to “Help”

Who is online

Users browsing this forum: No registered users and 14 guests