input problem

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

input problem

Post by Virion »

Weird, I've rechecked my code it's almost the same with tut 4. I've no idea why this thing comes out.
------ Build started: Project: ComingBackHome, Configuration: Debug Win32 ------
Compiling...
main.cpp
c:\comingbackhome\main.h(58) : error C2259: 'MyEventReceiver' : cannot instantiate abstract class
due to following members:
'bool irr::IEventReceiver::OnEvent(const irr::SEvent &)' : is abstract
c:\irrlicht-1.4\include\ieventreceiver.h(256) : see declaration of 'irr::IEventReceiver::OnEvent'
Build log was saved at "file://c:\ComingBackHome\Debug\BuildLog.htm"
GoingHome - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm using Irrlicht 1.4 (not svn) and using Visual C++ 2005 express.

Code: Select all

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_KEY_W:
				{
					break;
				}
			case KEY_KEY_S:
				{
					break;
				}
			default:
				return true;
			}
		}
	return false;
	}
};
Thanks.
zeno60
Posts: 342
Joined: Sun May 21, 2006 2:48 am
Location: NC, USA
Contact:

Post by zeno60 »

http://irrlicht.sourceforge.net/phpBB2/ ... %20OnEvent

Searched for "is AND abstract OnEvent." Why not have a gander through some of those.
konrad
Posts: 15
Joined: Wed Oct 03, 2007 7:07 pm
Location: Poland

Post by konrad »

Try this ;p

Code: Select all

class MyEventReceiver : public IEventReceiver
{
public:
   virtual bool OnEvent(const irr::SEvent& event)
   {
      if (event.EventType == irr::EET_KEY_INPUT_EVENT && event.KeyInput.PressedDown)
      {
         switch(event.KeyInput.Key)
         {
         case KEY_KEY_W:
            {
               break;
            }
         case KEY_KEY_S:
            {
               break;
            }
         default:
            return true;
         }
      }
   return false;
   }
};
Post Reply