IEventReceiver interface
Posted: Mon May 01, 2006 1:23 am
I'm trying to move the MyEventReceiver class from one of the irrlicht examples to a seperate .cpp and .h file (clean up the code), but when I then try to make an instance of it, and feed it to createDevice it gives me this:
error C2259: 'MyEventReceiver' : cannot instantiate abstract class
here's my code
MyEventReceiver.h:
and
in my Game class:
Any ideas?
error C2259: 'MyEventReceiver' : cannot instantiate abstract class
here's my code
MyEventReceiver.h:
and
in my Game class:
Code: Select all
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool MyEventReceiver::OnEvent(SEvent event,IrrlichtDevice* device)
{
if (event.EventType == irr::EET_KEY_INPUT_EVENT)
{
switch(event.KeyInput.Key)
{
case irr::KEY_ESCAPE:
{
device->closeDevice();
}
return true;
}
}
return false;
}
};
MyEventReceiver receiver;
_device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(1024, 768),16, false, false, false,&receiver);