1

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)

tshepang
  • 12,111
  • 21
  • 91
  • 136
Alex Kruger
  • 307
  • 1
  • 6
  • 9

2 Answers2

3

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();
    }
}
bob2
  • 1,092
  • 9
  • 18
0

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.

rfcoder89
  • 184
  • 10