EventReceiver

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
carou

EventReceiver

Post by carou »

I have a little problem. When i press 2 keys on the keyboard, is it possible to receive the 2 event (and how can i do that, because i receive only the first event)

:?

Tks
carou

Post by carou »

my code : (what's wrong???)

virtual bool OnEvent(SEvent event){

bool retour = false;
if ( event.EventType == irr::EET_KEY_INPUT_EVENT)
{

if(event.KeyInput.Key == KEY_KEY_Z)
{ {
core::vector3df v = node->getPosition();
v.Z += -2.0f;
node->setPosition(v);
retour = true;
}
else
{
if(event.KeyInput.Key == KEY_KEY_S)
{
core::vector3df v = node->getPosition();
v.Z += 2.0f;
node->setPosition(v);
retour = true;
}
}

if(event.KeyInput.Key == KEY_KEY_Q)
{
core::vector3df v = node->getPosition();
v.X += 2.0f;
node->setPosition(v);
retour = true;
}
else
{
if(event.KeyInput.Key == KEY_KEY_D)
{
core::vector3df v = node->getPosition();
v.X += -2.0f;
node->setPosition(v);
retour = true;
}
}
}




return retour;
}
Luke923
Posts: 59
Joined: Wed Nov 05, 2003 5:26 am

Post by Luke923 »

You might want to read the following URL:
http://irrlicht.sourceforge.net/phpBB2 ... php?t=808
"Object-oriented programming is an exceptionally bad idea which could only have originated in California."
- E.W. Dijkstra
thesmileman
Posts: 360
Joined: Tue Feb 10, 2004 2:20 am
Location: Lubbock, TX

Post by thesmileman »

I would also recommend the url Luke923 posted I have been using simular code to that which is discribed their and it works very well.
bappy
Posts: 63
Joined: Fri Dec 12, 2003 10:49 am
Location: france
Contact:

Post by bappy »

i had the same problem, lost input etc. finally i m using direct input for all movement and the event receiver for all other key. works pretty good and i dont miss any key
-----------------------------
Sans danger, pas de gloire...
http;//bappy.free.fr
-----------------------------
Post Reply