how to use qt4 and irrlicht3d

Started by
-1 comments, last by elsharkawey 8 years, 1 month ago

i want to write a code for irrlicht begin scene in a qt4 window that have a button for exit i tried many times but every tim that's open two windows and i want only to run th scene and the button in one window my code


#include <QApplication>
#include <QLabel>
#include <irrlicht.h>
#include <QApplication>
#include <QPushButton>
using namespace irr;
using namespace core;
using namespace video;
int main(int argc, char *argv[])
{

IrrlichtDevice* device = createDevice(EDT_OPENGL,dimension2d<u32>(640, 480), 16,false, false, false, 0);
if (!device)
return 1;
IVideoDriver* driver = device->getVideoDriver();
//qt4code



QApplication app(argc, argv);
QPushButton *button = new QPushButton(QString( "Qt/Irrlicht" ));
QObject::connect(button, SIGNAL(clicked()),&app, SLOT(quit()));
button->show();
app.exec();
//endcode
while (device->run())
{

 driver->beginScene(true, true, SColor(255, 255, 255,255));
 driver->endScene();


}
 device->drop();


 return 0;

}

This topic is closed to new replies.

Advertisement