Mainpage Menus

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

littlepig
Just popping in
Just popping in
Posts: 6
Joined: Fri Nov 05, 2010 09:09

Mainpage Menus

Postby littlepig » Tue Nov 09, 2010 18:25

Hi there, I'm currently working with CEGUI (with ogre) and I need some advices.

I am working on building a menu for a game. So, in my "main", I have:

-start game
-options
-quit

In my "options" I have:
-Return to menu

in my main.cpp, I used:

Code: Select all

   CEGUI::Window* pOptions = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"options.layout");
   Options* pOpt = new Options(pOptions, sim);
   
   CEGUI::Window* pMain = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"katana.layout");
   MainMenuDlg* pDlg = new MainMenuDlg(pMain, sim);   

to create the windows, and this

Code: Select all

CEGUI::System::getSingleton().setGUISheet(pMain);

for using them.

I'm trying to find a way of going from "main" to "options" and the vice-versa(I only have to setGUISheet() right?). In my main loop, I only have handler->capture (to capture IOS events) and a ogre->renderOneFrame().

In PracticalApp_CEGUI (from Xavier), there is a simulator class that controls in which part of the game the simulation is:

Code: Select all

typedef enum {
   STARTUP,
   GUI,
   OPTIONS, (I added this)
   LOADING,
   CANCEL_LOADING,
   SIMULATION,
   SHUTDOWN
} SimulationState;


What I'm asking is if is this the standard approach, using this simulationState to navigate trough the different windows of my menu, or this simulation state is for more general things like (GUI, Loading, Simulation, etc)? If not, what is the standard approach or where can I find it?

Thanks,
littlepig

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Mainpage Menus

Postby Kulik » Tue Nov 09, 2010 19:10

There are many ways to accomplish what you are describing and there are no standards on how to actually do it so it's up to you.

Xavier's practical application is one of the good ways to accomplish what you want to do.

In case you only switch between N layouts and you are never going to need 2+ layouts active at the same time you can just use setGUISheet. If you need more flexibility, you can set DefaultWindow as the GUISheet and add/remove windows from it depending on your needs. This way you can activate 2+ layouts at once. If you don't need this, following the simpler approach is better (KISS principle).

I have spent many hours trying to decide what's the right and wrong approach and unless you try them all you will never know :D

littlepig
Just popping in
Just popping in
Posts: 6
Joined: Fri Nov 05, 2010 09:09

Re: Mainpage Menus

Postby littlepig » Tue Nov 09, 2010 20:51

Kulik wrote:There are many ways to accomplish what you are describing and there are no standards on how to actually do it so it's up to you.

Xavier's practical application is one of the good ways to accomplish what you want to do.

In case you only switch between N layouts and you are never going to need 2+ layouts active at the same time you can just use setGUISheet. If you need more flexibility, you can set DefaultWindow as the GUISheet and add/remove windows from it depending on your needs. This way you can activate 2+ layouts at once. If you don't need this, following the simpler approach is better (KISS principle).

I have spent many hours trying to decide what's the right and wrong approach and unless you try them all you will never know :D


Thanks! much appreciated. :)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 29 guests