I used a diferent class for input.
I didnt use MyEventReceiver:public IEventReceiver.
This the code im using:
void cPlayer::Input(SEvent event, sCharacter *Char, ITimer* TimeElapsed, IVideoDriver* driver, ISceneManager* smgr, IrrlichtDevice *device, ICameraSceneNode* camera)
{
float speed =1;
Char->TimeElapsed = TimeElapsed->getRealTime();
if (event.KeyInput.Key == KEY_KEY_W && event.KeyInput.PressedDown)
{
Char->sngWalk = 1;
}
if (event.KeyInput.Key == KEY_KEY_S && event.KeyInput.PressedDown)
{
Char->sngWalk = -1;
}
if (event.KeyInput.Key == KEY_KEY_A && event.KeyInput.PressedDown)
{
Char->sngStrafe = 1;
}
if (event.KeyInput.Key == KEY_KEY_D && event.KeyInput.PressedDown)
{
Char->sngStrafe = -1;
}
Can i do this or i have to use MyEventReceiver class because event is not working working.
Thanks in advance.
INput problem
Without seeing the entire class i can't really comment,
but your passing 7 different parameters for an input function, thats quite a lot considering that the event is the only thing likely to be different in between calls. And also the scenemanger and video driver and timer should be accessible from the device anyway.
And I assume you have a cPlayer::OnEvent() function, because thats the one thats probably recieveing events not this function.
but your passing 7 different parameters for an input function, thats quite a lot considering that the event is the only thing likely to be different in between calls. And also the scenemanger and video driver and timer should be accessible from the device anyway.
And I assume you have a cPlayer::OnEvent() function, because thats the one thats probably recieveing events not this function.