Page 1 of 1

Strange bug with Key-Events.

Posted: Thu Sep 30, 2004 8:16 pm
by Dingsi
Heyho.
I have a problem (suprising, don't? ^^).

Code: Select all

  bool OnEvent(SEvent event)
  {
    if (event.KeyInput.Key == KEY_ESCAPE && event.KeyInput.PressedDown) done = true;
  }
'done' is a global bool-variable and it controls the main-loop. (... if (done) break; ...)
So as you can see, the program should break when someone hits ESC. But the condition in the event-receiver is also fulfilled ('done' is set to true) when I move the mouse exactly at the Y-Pos 27. (It looks like the X-Pos doesn't matter).

It's crazy, doesn't it? o__O.

Please help. Oo.

Posted: Thu Sep 30, 2004 9:44 pm
by jikbar
try it with the logical AND (&) instead of the binary AND (&&)

or you could just ignore the PressedDown part

might not work, but its worth suggesting :wink:

Posted: Thu Sep 30, 2004 10:14 pm
by mm765
you need to check, if it is a keyeevent at all..could be a gui event or logevent or whatever.

Posted: Thu Sep 30, 2004 11:39 pm
by Acki
Maybe you should have a look on this thread:
http://irrlicht.sourceforge.net/phpBB2/ ... sc&start=0

Posted: Fri Oct 01, 2004 11:19 am
by Dingsi
Mh, mh. Yeah. I did not check whether the event is a key-event. With if(event.EventType == EET_KEY_INPUT_EVENT... it works how it should work.

But it's nevertheless very, very strang that an event with Key as KEY_ESCAPE is sent to the receiver when the mouse is exactly at 27.. or are mouseInput and keyInput sharing their memory? that could be the answer... ya..
try it with the logical AND (&) instead of the binary AND (&&)
&& is the local AND. o_O. & is binary.

Posted: Sat Oct 02, 2004 12:33 am
by Acki
Well, I think because 27 is the ASCI code for Escape and the receiver does not know what kind of code the given 27 are the receiver get the most common way - ASCI...