IeventReciever error????[solved]
Posted: Sun Jan 13, 2008 8:01 pm
this is a trimmed down version of the movement tut (4)
i am trying to run this ,but it giver the following errors:
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
test.cpp
Compiling Irrlicht with Visual Studio 6.0, support for DX9 is disabled.
c:\foobar\irredit-1.4alpha\test.cpp(41) : error C2259: 'MyEventReceiver' : cannot instantiate abstract class due to following members:
c:\foobar\irredit-1.4alpha\test.cpp(12) : see declaration of 'MyEventReceiver'
c:\foobar\irredit-1.4alpha\test.cpp(41) : warning C4259: 'bool __thiscall irr::IEventReceiver::OnEvent(const struct irr::SEvent &)' : pure virtual function was not defined
d:\program files\microsoft visual studio\vc98\include\ieventreceiver.h(256) : see declaration of 'OnEvent'
c:\foobar\irredit-1.4alpha\test.cpp(41) : error C2259: 'MyEventReceiver' : cannot instantiate abstract class due to following members:
c:\foobar\irredit-1.4alpha\test.cpp(12) : see declaration of 'MyEventReceiver'
c:\foobar\irredit-1.4alpha\test.cpp(41) : warning C4259: 'bool __thiscall irr::IEventReceiver::OnEvent(const struct irr::SEvent &)' : pure virtual function was not defined
d:\program files\microsoft visual studio\vc98\include\ieventreceiver.h(256) : see declaration of 'OnEvent'
c:\foobar\irredit-1.4alpha\test.cpp(53) : error C2039: 'addTestSceneNode' : is not a member of 'ISceneManager'
d:\program files\microsoft visual studio\vc98\include\iscenemanager.h(148) : see declaration of 'ISceneManager'
Error executing cl.exe.
test.exe - 3 error(s), 2 warning(s)
#include <stdio.h>
#include <wchar.h>
#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
scene::ISceneNode* node = 0;
IrrlichtDevice* device = 0;
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (node != 0 && event.EventType == irr::EET_KEY_INPUT_EVENT &&
!event.KeyInput.PressedDown)
{
switch(event.KeyInput.Key)
{
case KEY_KEY_W:
case KEY_KEY_S:
{
core::vector3df v = node->getPosition();
v.Y += event.KeyInput.Key == KEY_KEY_W ? 2.0f : -2.0f;
node->setPosition(v);
}
return true;
}
}
return false;
}
};
int main()
{
MyEventReceiver receiver;
device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640, 480),
16, false, false, false, &receiver);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
node = smgr->addTestSceneNode();
node->setPosition(core::vector3df(0,0,30));
node->setMaterialTexture(0, driver->getTexture("Projrctmedia/wood74-r.jpg"));
smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
device->getCursorControl()->setVisible(false);
int lastFPS = -1;
while(device->run())
{
driver->beginScene(true, true, video::SColor(255,90,90,156));
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
wchar_t tmp[1024];
swprintf(tmp, 1024, L"Movement Example - Irrlicht Engine (%s)(fps:%d)",
driver->getName(), fps);
device->setWindowCaption(tmp);
lastFPS = fps;
}
}
device->drop();
return 0;
}
i am trying to run this ,but it giver the following errors:
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
test.cpp
Compiling Irrlicht with Visual Studio 6.0, support for DX9 is disabled.
c:\foobar\irredit-1.4alpha\test.cpp(41) : error C2259: 'MyEventReceiver' : cannot instantiate abstract class due to following members:
c:\foobar\irredit-1.4alpha\test.cpp(12) : see declaration of 'MyEventReceiver'
c:\foobar\irredit-1.4alpha\test.cpp(41) : warning C4259: 'bool __thiscall irr::IEventReceiver::OnEvent(const struct irr::SEvent &)' : pure virtual function was not defined
d:\program files\microsoft visual studio\vc98\include\ieventreceiver.h(256) : see declaration of 'OnEvent'
c:\foobar\irredit-1.4alpha\test.cpp(41) : error C2259: 'MyEventReceiver' : cannot instantiate abstract class due to following members:
c:\foobar\irredit-1.4alpha\test.cpp(12) : see declaration of 'MyEventReceiver'
c:\foobar\irredit-1.4alpha\test.cpp(41) : warning C4259: 'bool __thiscall irr::IEventReceiver::OnEvent(const struct irr::SEvent &)' : pure virtual function was not defined
d:\program files\microsoft visual studio\vc98\include\ieventreceiver.h(256) : see declaration of 'OnEvent'
c:\foobar\irredit-1.4alpha\test.cpp(53) : error C2039: 'addTestSceneNode' : is not a member of 'ISceneManager'
d:\program files\microsoft visual studio\vc98\include\iscenemanager.h(148) : see declaration of 'ISceneManager'
Error executing cl.exe.
test.exe - 3 error(s), 2 warning(s)
#include <stdio.h>
#include <wchar.h>
#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
scene::ISceneNode* node = 0;
IrrlichtDevice* device = 0;
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (node != 0 && event.EventType == irr::EET_KEY_INPUT_EVENT &&
!event.KeyInput.PressedDown)
{
switch(event.KeyInput.Key)
{
case KEY_KEY_W:
case KEY_KEY_S:
{
core::vector3df v = node->getPosition();
v.Y += event.KeyInput.Key == KEY_KEY_W ? 2.0f : -2.0f;
node->setPosition(v);
}
return true;
}
}
return false;
}
};
int main()
{
MyEventReceiver receiver;
device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640, 480),
16, false, false, false, &receiver);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
node = smgr->addTestSceneNode();
node->setPosition(core::vector3df(0,0,30));
node->setMaterialTexture(0, driver->getTexture("Projrctmedia/wood74-r.jpg"));
smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
device->getCursorControl()->setVisible(false);
int lastFPS = -1;
while(device->run())
{
driver->beginScene(true, true, video::SColor(255,90,90,156));
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
wchar_t tmp[1024];
swprintf(tmp, 1024, L"Movement Example - Irrlicht Engine (%s)(fps:%d)",
driver->getName(), fps);
device->setWindowCaption(tmp);
lastFPS = fps;
}
}
device->drop();
return 0;
}