[Resolved]How to quit a game properly using a button

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

metylbk
Just popping in
Just popping in
Posts: 11
Joined: Fri Jul 08, 2011 18:59

[Resolved]How to quit a game properly using a button

Postby metylbk » Thu Dec 01, 2011 11:03

I use Ogre, IOS, CEGUI to develop my Game. this is main.cpp
CMKGame* game = CMKGame::create();
if(game->init())
game->run();
CMKGame::destroy();

After init Ogre, I create a render window:
Ogre::RenderWindow* pRenderWindow = Ogre::Root::getSingleton().createRenderWindow(
"MK", 1024, 768, false, &windowParametterList);
If I click on default Close button on the Main render window, the window will be close and the CMKGame::destroy function will be called to unload resources and destroy other things. So Game exit properly.
But, In login Game state, I have a button to exit the game, and when click on this button, I wanna exit game. So I call the function CMKGame::destroy in OnExitButtonClicked(), but the Render window is not closed so the game is crashed because of something relate to OIS mouse capture, click.
How can I close the Render Window before calling CMKGame::destroy or any one has other solutions to resolve this problem.
Last edited by metylbk on Fri Dec 02, 2011 05:02, edited 1 time in total.

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

Re: How to quit a game properly using a button in CEGUI

Postby Kulik » Thu Dec 01, 2011 14:05

Not a CEGUI question at all. You probably should flip some switch that will cause the runloop to terminate.

EDIT: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=67793

metylbk
Just popping in
Just popping in
Posts: 11
Joined: Fri Jul 08, 2011 18:59

Re: [Resolved]How to quit a game properly using a button

Postby metylbk » Fri Dec 02, 2011 05:03



Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests