The following code closes my application instead of resetting the resolution:
Code: Select all
void CMazeGameEngine::setResulotion(unsigned int in_width, unsigned int in_height)
{
init(in_width, in_height);
setupMenuAndWinScreen();
if (isGameOngoing())
setupWorld();
startEventLoop();
}
void CIrrlichtEngineInterface::init(unsigned int in_screenWidth, unsigned int in_screenHeight)
{
if (_device)
{
_device->closeDevice();
_device->drop();
}
_device =
irr::createDevice(irr::video::EDT_OPENGL, irr::core::dimension2d<irr::u32>(in_screenWidth, in_screenHeight), 16,
false, false, false, 0);
}
The startEventLoop function starts the while(_device->run()) loop.
My intention is that the last window will close (since it's _device will no longer run) and the new window will take it's place.
This, however, does not happen - they both close!
If I don't do _device->closeDevice() - than two windows with different resolutions are present...
What am I missing?