Loading CEGUI in two different scene managers in Ogre

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

Xura
Just popping in
Just popping in
Posts: 3
Joined: Mon Sep 01, 2008 21:33

Loading CEGUI in two different scene managers in Ogre

Postby Xura » Mon Sep 01, 2008 22:33

Hi Everyone

Just want to say CEGUI is great and is a fun learning experience. I have a query with regard to a technique for loading CEGUI on two different scene managers in Ogre.
Here is my story:
I have a primary scene manger and I would like to switch to the secondary scene manager by clicking for e.g. an 'OK' button in the primary scene manager (i have been able to do that). But here is the problem once I switch to the secondary scene manager I would like render another separate GUI layout (with buttons, etc).
I understand that CEGUI will only render itself on one scene at a time. So I here's what I have:
I have a createScene() function which is overidden from the ExampleApplication.h and that basically initialises CEGUI just like in the tutorial.

Code: Select all

void createScene(void)
    {
       mPrimary->setSkyDome(true, "Examples/CloudySky");
      mSecondary->setSkyBox(true, "Examples/SpaceSkyBox");
      
      //Initialisation of CEGui for Window_1
      mRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mPrimary);
       mSystem = new CEGUI::System(mRenderer);
      CEGUI::SchemeManager::getSingleton().loadScheme("TaharezLookSkin.scheme");   //Initialise skin (looknfeel)
      CEGUI::SchemeManager::getSingleton().loadScheme("WindowsLook.scheme");
      mSystem->setDefaultMouseCursor("TaharezLook", "MouseArrow");   //Initialise default mouse cursor
      mSystem->setDefaultFont("BlueHighway-12");               // Set Up Font


      //Creating a default CEGUI window to insert widgets
      CEGUI::WindowManager *win = CEGUI::WindowManager::getSingletonPtr();
       //CEGUI::Window *sheet = win->createWindow("DefaultGUISheet", "CEGUIDemo/Sheet");
      CEGUI::Window *sheet = win->loadWindowLayout("Configuration_Window.xml");
      mSystem->setGUISheet(sheet);      //Set current GUI sheet for system to be this sheet
      
   }

Also I am trying for arguments sake to load the same GUI in different scene managers. (Hence only one GUI layout). My event handling is done in the constructor of a class which inherits from the ExampleFrameListener.h class and is implemented as follows.

Code: Select all

CEGUI::Window *start = wmgr->getWindow("Root//5");
     start->subscribeEvent(CEGUI::PushButton::EventClicked,
         CEGUI::Event::Subscriber(&TutorialListener::OK_Clicked, this));


I was hoping to switch scene managers in the 'OK_Clicked' function but it does not work and I also tried mRenderer->setTargetSceneManager(...).

Any help will be appreciated as this might be something easy to solve but my brain isnt clicking.



Thanks :)

wally
Just popping in
Just popping in
Posts: 20
Joined: Wed Jul 09, 2008 09:45
Location: Canberra, Australia

Postby wally » Wed Nov 19, 2008 04:00

I have no problems using the mRenderer->setTargetSceneManager(...) to switch between different Ogre scene managers.

Can you give more details than "it does not work"...

First thing to check is if your OK_Clicked function is actually being called. (Put a breakpoint there, see if it gets hit)
I'm assuming this is where you tried setTargetSceneManager.

What specifically is not working?
GUI not showing up in new scene?

EDIT> Heh, just noticed your post was over 2 months old. Hopefully you got it sorted anyhow.

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

Postby CrazyEddie » Wed Nov 19, 2008 09:40

wally wrote:EDIT> Heh, just noticed your post was over 2 months old. Hopefully you got it sorted anyhow.

I feel bad now, since their post was made on the day I returned from my summer break, yet somehow I overlooked it.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 14 guests