Changing Schemes

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
apperenticegp
Just popping in
Just popping in
Posts: 7
Joined: Fri Jul 15, 2005 23:54

Changing Schemes

Postby apperenticegp » Mon Nov 14, 2005 14:18

Hello everyone. I've made a lot of progress to learning CEGUI for these past days but a concern popped up. How do I change schemes in CEGUI to facilitate screen changes? Right now I have a scheme file for my project's main menu and another for a loading screen. This is how my concept works. The main menu scheme has four buttons: new game, load game, options and exit. Suppose you click the load game button, the load screen scheme and its layout should show and the main menu hidden or unloaded somewhat. I have the following code segment in my screen transition:

LoadScreen::setupStuff()
{
:
// Works fine up to this point.
CEGUI::SchemeManager::getSingleton().unloadScheme((CEGUI::utf8*)"MainMenu.scheme");

// This cracks my code when it runs!
CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"LoadScreen.scheme");

:

}

Yes, whenever I unload a scheme then load a new one, my app breaks down. I read the documentation to take precautions but I can't pinpoint where it happens internally.

By the way, I'm still using the Ogre3D + CEGUI version 3 in my linux box. Both schemes use TaharezLook. I hope any of you can help me on this one. I think it's possible to do transitions with layouts but what if I have some different set of buttons for the Main Menu scheme and for the Load Screen? At the moment, both screens have their own layout file, scheme file and imagesets.

Advance thanks.

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

Re: Changing Schemes

Postby lindquist » Mon Nov 14, 2005 16:04

A scheme is used to specify a "package" of resources to load.
Every time you unload a scheme, the resources specified in it are freed.
As you said you use TaharezLook in both, did you mean that you load that "skin" in both schemes? This is not exactly efficient...
I think what you want to do is to load your gui resources in a scheme, and then just manage layouts afterwards instead.
If all your GUI uses the same look, font etc. This would be much better.

And by the way, SchemeManager::unloadScheme takes a scheme name (the one specifed inside the .scheme file) not a filename. And you must ensure that EVERYTHING that uses any resources loaded in that scheme is destroyed before calling unloadScheme.

User avatar
apperenticegp
Just popping in
Just popping in
Posts: 7
Joined: Fri Jul 15, 2005 23:54

Re: Changing Schemes

Postby apperenticegp » Mon Nov 14, 2005 16:49

I'll take your advice lindquist. You're right. I'm using the same TaharezLook theme but with a different image file for the imageset per screen. So that's why my code simply cracks when changing schemes instantaneously!

Thanks a lot. :)


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 8 guests