开发者

Irrlicht Engine: Window pops up and disappears instantly

开发者 https://www.devze.com 2023-02-14 19:31 出处:网络
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.

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 f开发者_StackOverflowrom the HelloWorld tutorial of the documentation)


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();
    }
}


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

精彩评论

暂无评论...
验证码 换一张
取 消