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
disabling the GUI sheet
Moderators: CEGUI MVP, CEGUI Team
Re: disabling the GUI sheet
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.
There is probably a better way, and I'd like to know what it is as well.
Re: disabling the GUI sheet
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:
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:
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:
And there you have it. Each time you press the ESC key, it will either show or hide the GUI.
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.
Re: disabling the GUI sheet
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.
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.
Re: disabling the GUI sheet
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.
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 1 guest