main.cpp
Code: Select all
#include <Irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
int main()
{
// start up the engine
IrrlichtDevice *device = createDevice(video::EDT_OPENGL,
core::dimension2d<s32>(640,480), false);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* scenemgr = device->getSceneManager();
gui::ICursorControl * cursorcontrol = device->getCursorControl();
cursorcontrol->setVisible(false);
// set initial window title shown whilst loading
device->setWindowCaption(L"Cameleon Engine");
// add .pk3 archive to the file system
device->getFileSystem()->addZipFileArchive("maps/map-20kdm2.pk3");
// load .bsp file and show it using an octtree
scenemgr->addOctTreeSceneNode(scenemgr->getMesh("20kdm2.bsp"));
// add a first person shooter style user controlled camera
scenemgr->addCameraSceneNodeFPS();
wchar_t tmp[255];
// draw everything
while(device->run() && driver)
{
driver->beginScene(true, true, video::SColor(255,0,0,255));
scenemgr->drawAll();
driver->endScene();
// get driver name and fps to display in window title
swprintf(tmp, 255, L"Cameleon Engine (%s fps:%d)", driver->getName(), driver->getFPS());
device->setWindowCaption(tmp);
}
// delete device
device->drop();
return 0;
}
I have a few questions which may help me choose one of the two possible methods:
Should I be inheriting from CCameraSceneNode or ICameraSceneNode if I make a custom camera class?
If using an event receiver, how to I stop it from stuttering? When I press a key, the camera moves forward, stutters and then carries on OK.