Page 1 of 1

input problem

Posted: Fri Dec 21, 2007 5:21 pm
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.

Posted: Fri Dec 21, 2007 5:32 pm
by zeno60
http://irrlicht.sourceforge.net/phpBB2/ ... %20OnEvent

Searched for "is AND abstract OnEvent." Why not have a gander through some of those.

Posted: Fri Dec 21, 2007 5:59 pm
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;
   }
};