Advertisement
Kitomas

first irrlicht thing

Feb 14th, 2025 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.56 KB | None | 0 0
  1. #include <include_all.hpp>
  2.  
  3. //begone, unused parameter warning
  4. #define UM_RETURN(_val) { (void)argc, (void)argv; return (_val); }
  5.  
  6. using namespace irr;
  7.  
  8.  
  9.  
  10.  
  11.  
  12. int user_main(int argc, char** argv){
  13.   IrrlichtDevice* device;
  14.  
  15.   device = createDevice(video::EDT_OPENGL, core::dimension2d<u32>(640,480),
  16.   //device = createDevice(video::EDT_BURNINGSVIDEO, core::dimension2d<u32>(640,480),
  17.                         16, false, false, false, 0);
  18.  
  19.   if(!device) return -2;
  20.  
  21.   device->setWindowCaption(L"Irrlicht Engine Demo - OpenGL");
  22.  
  23.  
  24.  
  25.   video::IVideoDriver*  driver = device->getVideoDriver();
  26.   scene::ISceneManager* smgr   = device->getSceneManager();
  27.   gui::IGUIEnvironment* guienv = device->getGUIEnvironment();
  28.  
  29.  
  30.  
  31.   scene::IAnimatedMesh* mesh = smgr->getMesh("sydney.md2");
  32.  
  33.   if(!mesh){
  34.     device->drop();
  35.     return 1;
  36.  
  37.   }
  38.  
  39.   scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
  40.  
  41.   if(node){
  42.     node->setMaterialFlag(video::EMF_LIGHTING, false);
  43.     node->setMD2Animation(scene::EMAT_STAND);
  44.     node->setMaterialTexture(0, driver->getTexture("sydney.png"));
  45.  
  46.   }
  47.  
  48.   smgr->addCameraSceneNode(0, core::vector3df(0,30,-40),
  49.                               core::vector3df(0, 5,  0));
  50.  
  51.  
  52.  
  53.   //(the audio stuff is mine, everything else is from irrlicht)
  54.   music_setFadeDelta(4);
  55.   music_play(2);
  56.  
  57.   while(device->run()){
  58.     driver->beginScene(true, true, video::SColor(255,100,101,140));
  59.  
  60.     smgr->drawAll();
  61.     guienv->drawAll();
  62.  
  63.     driver->endScene();
  64.  
  65.   }
  66.  
  67.  
  68.  
  69.   device->drop();
  70.  
  71.   UM_RETURN(0);
  72.  
  73. }
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement