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
majc
Posts: 6
Joined: Wed Sep 14, 2005 7:04 pm

INput problem

Post 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.
cpprules
Posts: 148
Joined: Wed Jul 27, 2005 8:37 pm
Location: on the Pedastal

Post by cpprules »

i would reccomend you to use something other for imput, maybe Windows API?
Afterall Irrlicht is just graphics engine.
CRPG, FRPG, Oblivion Fan
Hater of Counter Strike (i hate it so much damn it)
FlyHigh
Posts: 111
Joined: Wed Mar 23, 2005 12:05 am

Post 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.
Post Reply