Page 1 of 1

INput problem

Posted: Thu Sep 15, 2005 2:30 pm
by majc
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.

Posted: Thu Sep 15, 2005 3:01 pm
by cpprules
i would reccomend you to use something other for imput, maybe Windows API?
Afterall Irrlicht is just graphics engine.

Posted: Thu Sep 15, 2005 3:26 pm
by FlyHigh
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.