re-creating device during run-time

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
fargoth
Posts: 22
Joined: Fri May 01, 2015 7:43 pm

re-creating device during run-time

Post by fargoth »

I want to change the device settings (e.g. resolution, full screen) during run-time.

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 setResolution function is called from an eventReciever, (while the standard event loop of while(_device->run()) is running)
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?
Ovan
Posts: 70
Joined: Thu Dec 18, 2008 12:41 am
Contact:

Re: re-creating device during run-time

Post by Ovan »

http://irrlicht.sourceforge.net/forum/v ... =9&t=50332
on the svn this functionality is implemented << IrrlichtDevice::setWindowSize >>
Post Reply