Pausing scenes..

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Quall
Posts: 154
Joined: Mon Mar 07, 2005 10:16 pm

Pausing scenes..

Post by Quall »

Hello, I am working on the design of my games framework. I decided to create classes with their own scene managers and event receivers, The basic classes are for the main menu, the game, and a pause menu. However, the concept of the pause menu has got me stumped.

You see, I do not want the pause menu to be driven by gui events. I'd rather have key input to navigate between the menu's animated bitmaps for the text, instead of an external font. Maybe even 3d nodes as text. I cannot simply pause the device since the nodes in the menu will pause as well (highlight events will not be updated). This is where the stumping begins.

When switching to the game's scene and the pause menu, I want to switch and freeze the game's scene. For reasons above, I cannot pause the device. I am not sure how I would accomplish this. I did not see a method that would stop updating all animations and animators in a specific scene. Any ideas throw at me will be helpful.
Guest

Post by Guest »

Code: Select all

bool freeze = false;

while(device->run())
{
driver->beginScene(blabla);

if(freeze == false)
{
smgr->drawAll();
yourUpdateFunctions();
//otherstuff
}

guienv->drawAll();
driver->endScene();
}

if you want to freeze the game, set freeze = true;

i think this _could_ work, but i dont know for sure nor did i test it :)
Quall
Posts: 154
Joined: Mon Mar 07, 2005 10:16 pm

Post by Quall »

Not exact what I am looking for. This might get a little confusing.. The first post is kind of langthy to read, so this is how it will *basically* be set up.

Code: Select all

P pressed: 
smgr = pointer to pause menu scene
Event receiver = pause receiver

P pressed again: 
smgr = pointer to game scene
Event receiver = game receiver

then:

while(device->run())
{
driver->beginScene(blabla);
smgr->drawAll();
driver->endScene();
} 
This way, I could have a 3d scene as a pause menu instead of the gui environment. The scene will simply change along with the menu events. However, while the pause menu is being rendered, the game scene will still be updated (like animations and animators) in the background (i think). So when I unpause the menu, everything would somewhat be out of sync, or may have even disappeared if it was some kind of particle effect.

I don't want the scene without focus to be updating in the background, Like some way to pause all animaters in the engine without creating some other method that would pause them all.
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

ummmm I don't know about that. You can't swap smgr on the fly and make it point to a different scene. GFXstyLER's idea of using a boolean flag to keep track of game state is more appropriate. Basically, when the game is in pause mode, anything that controls game actions does not get called. If you have animators in place, you will have to pause or destroy them somehow.
Guest

Post by Guest »

The "pausing" of animators is easily achieved with the new ITimer stuff in 0.12
Post Reply