1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#include <irr/irrlicht.h>
#include <stdio.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main(int argc, char** argv)
{
IrrlichtDevice *device =
createDevice(EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
printf("pas d fenetre\n");
else
printf("fenetre ok\n");
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
if(!driver)
printf("driver null \n");
else
printf("driver ok \n");
if(!guienv)
printf("guienv null \n");
else
printf("guienv ok \n");
if(!smgr)
printf("smgr null \n");
else
printf("smgr ok \n");
/*
if(guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<int>(10,10,200,22), true) == NULL)
printf("test null");
else
printf("text ok");
*/
printf("try load mesh with smgr which were OK");
IAnimatedMesh* mesh;
mesh = smgr->getMesh("abeille2.obj");
if (!mesh)
{
device->drop();
return 1;
}
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setFrameLoop(0, 310);
node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
}
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
while(device->run())
{
driver->beginScene(true, true, SColor(0,200,200,200));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
} |
Partager