![Smile :)](./images/smilies/icon_smile.gif)
i suggest to read the irrlicht tutorials.
Code: Select all
#include <irrlicht.h>
#include <iostream>
using namespace irr;
using namespace core;
using namespace video;
using namespace scene;
using namespace gui;
using namespace io;
#pragma comment(lib, "Engine.lib")
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)
switch(event.KeyInput.Key)
{
case KEY_ESCAPE:
{
IrrlichtDevice* irrDevice = device->drop();
break;
}
}
return false;
}
};
The following is wrong#include <irrlicht.h>
#include <iostream>
using namespace irr;
using namespace core;
using namespace video;
using namespace scene;
using namespace gui;
using namespace io;
#pragma comment(lib, "Engine.lib")
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)
switch(event.KeyInput.Key)
{
case KEY_ESCAPE:
{
IrrlichtDevice* irrDevice = device->drop();
break;
}
}
return false;
}
};