Code: Select all
// FILE : _irrlicht.h
#ifndef EASYIRR
#define EASYIRR
#include <irrlicht.h>
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
/* NAME SPACES ON IRRLICHT*/
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
class _Irrlicht
{
private:
public:
IVideoDriver* _driver;
ISceneManager* _smgr;
IGUIEnvironment* _guienv;
IrrlichtDevice* _device;
_Irrlicht(int x, int y)
{
// Create Device
this->_device=createDevice(video::EDT_DIRECT3D9,dimension2d<s32>(x,y),16,false,false,false,0);
this->_driver=this->_device->getVideoDriver();
this->_smgr=this->_device->getSceneManager();
this->_guienv=this->_device->getGUIEnvironment();
}
};
#endif
it can use like this.
Code: Select all
#include "_irrlicht.h"
void main()
{
// Irrlicht Initizing
_Irrlicht *ir=new _Irrlicht(800,600);
while(ir->_device->run())
{
ir->_driver->beginScene(true, true, SColor(0,100,100,100));
ir->_smgr->drawAll();
ir->_guienv->drawAll();
ir->_driver->endScene();
}
}
if you must use "int main()", try this.
Code: Select all
#include "_irrlicht.h"
int main()
{
// Irrlicht Initizing
_Irrlicht *ir=new _Irrlicht(800,600);
while(ir->_device->run())
{
ir->_driver->beginScene(true, true, SColor(0,100,100,100));
ir->_smgr->drawAll();
ir->_guienv->drawAll();
ir->_driver->endScene();
}
ir->_device->drop();
return 0;
}