OnEvent never calls....

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
fnolis
Posts: 10
Joined: Thu Jun 24, 2004 8:25 am
Location: Sweden

OnEvent never calls....

Post by fnolis »

I have made a game class which I have declared the needed virtual OnEvent but it never calls. What could be the problem? No errors when compiling and the program runs as it should (exept for the event handler)

e.g

Code: Select all

bool GameMain::OnEvent( irr::SEvent event ) {
  printf( "Event\n" );
  return true;
}
Using irr 1.3.1 and Visual C++ 2005 on Win XP.
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

make sure in createDevice, the eventReceiver paremeter is 'this' (if createDevice is used in some function in GameMain) or a pointer to GameMain

example:

Code: Select all

dvc = createDevice(EDT_OPENGL, dimension2d<s32>(640,480), 16, false, false, false, this);
or

Code: Select all

dvc->setEventReceiver(this);

or

Code: Select all

dvc->setEventReceiver(&gamemainpointer);
Post Reply