disabling the GUI sheet

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
granx
Quite a regular
Quite a regular
Posts: 80
Joined: Fri Apr 29, 2005 21:58

disabling the GUI sheet

Postby granx » Wed Jul 13, 2005 01:50

Hi,
In my application, I would like to stop showing the GUI. What options do I have? Basically, I want to keep the System alive for usage later, but I don't want any sheets being displayed. Thanks for you thoughts, -granx

User avatar
khariq
Just popping in
Just popping in
Posts: 9
Joined: Mon Mar 21, 2005 14:40

Re: disabling the GUI sheet

Postby khariq » Wed Jul 13, 2005 13:36

Wrap all of the widgets in that sheet in a default window and then hide the window when you want it to go away and show it when you want it back. This is how I do in game system menus and also how I add things to the dead pool.

There is probably a better way, and I'd like to know what it is as well.

User avatar
J_A_X
Quite a regular
Quite a regular
Posts: 72
Joined: Wed Jun 29, 2005 13:18
Contact:

Re: disabling the GUI sheet

Postby J_A_X » Wed Jul 13, 2005 14:35

This is quite easy to achieve.

The CEGUI system will stay in the same state as long as you don't delete thee singleton pointer. From what I understand, you don't want the GUI to be displayed. This can be achieved from the game (or render) loop. Your game (or render) loop should have this line somewhere:

Code: Select all

//Renders GUI
CEGUI::System::getSingleton().renderGUI();


Now, in a game, there are many variables to be passed back and forth, normally state variables. A good practice is to have a class that holds all these states, but for this example we'll just say that our variable (a global variable) is a bool named RENDERGUI.

So from the code above, you should replace it with so:

Code: Select all

if(RENDERGUI){
//Renders GUI
CEGUI::System::getSingleton().renderGUI();
}


When RENDERGUI is false, the gui will not display on the screen and vica versa. Since this is a global variable, it should be accessed by any function. For example: If you are in the game presently and want to access the console or go into options by pressing the ESC key (which is what most games do), then your keyboard input function for the ESC key should just do this:

Code: Select all

RENDERGUI = !RENDERGUI;


And there you have it. Each time you press the ESC key, it will either show or hide the GUI.

User avatar
granx
Quite a regular
Quite a regular
Posts: 80
Joined: Fri Apr 29, 2005 21:58

Re: disabling the GUI sheet

Postby granx » Wed Jul 13, 2005 16:11

Hey guys,
Thanks for the good ideas. I have decided to go with the Window::hide() call, as I think it will allow me to manage many windows at once. After reading your suggestions, I realized that the Window API was where I needed to be looking, previously I was digging around in System. The Window API has a few calls that will active/deactivate, hide/show, enable/disable. For my request, it looks like hide/show are the way to go. I am just happy that the CEGUI API hasn't let me down as of yet, even if the desired effects are hard to find sometimes. If anyone knows of techniques that help you to manage the hide/show (or other behaviors) for multiple windows, I would like to hear about it. Thanks.

User avatar
J_A_X
Quite a regular
Quite a regular
Posts: 72
Joined: Wed Jun 29, 2005 13:18
Contact:

Re: disabling the GUI sheet

Postby J_A_X » Wed Jul 13, 2005 17:14

well then, that goes more into game programming theory than anything else. What I'm currently doing is making a class for every type of window I might have (ie. Console window) which then calls the superclass window which has all the properties and functions that windows can have.

The pointer to each window created is then placed in a window array where they can be called for when needed or could be used to make a mass change. You should read up on proper software engineering design and game programming.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 3 guests