Irrlicht Engine: Window pops up and disappears instantly

386 Views Asked by At

I wanted to create a simple IrrlichtDevice with IrrlichtEngine, but when I start the application, the window just appears on the screen and then instantly disappears.

My code looks like following:

int main()
{
    IrrlichtDevice *device =
            createDevice( video::EDT_DIRECT3D9, dimension2d<u32>(640, 480), 16,
                    false, false, false, 0);
}

(code copied from the HelloWorld tutorial of the documentation)

2

There are 2 best solutions below

0
On

You have no looping system in place. After you create the device the function immediately ends and everything is cleaned up.

bob2 has the correct answer, I would suggest that you practice making simple c++ applications before diving in the deep end.

0
On

Try

int main()
{
    IrrlichtDevice *device =
        createDevice( video::EDT_DIRECT3D9, dimension2d<u32>(640, 480), 16,
                false, false, false, 0);
    while( device->run() )
    {   device->getVideoDriver()->beginScene( true, true, video::SColor( 50, 50, 50, 50) );
        device->getVideoDriver()->endScene();
    }
}