Tks
EventReceiver
-
carou
EventReceiver
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
Tks
-
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;
}
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;
}
You might want to read the following URL:
http://irrlicht.sourceforge.net/phpBB2 ... php?t=808
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
- E.W. Dijkstra
-
thesmileman
- Posts: 360
- Joined: Tue Feb 10, 2004 2:20 am
- Location: Lubbock, TX