Strange bug with Key-Events.

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
Dingsi

Strange bug with Key-Events.

Post 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.
jikbar
Posts: 62
Joined: Wed Aug 25, 2004 4:48 pm
Location: Canada
Contact:

Post 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:
mm765
Posts: 172
Joined: Fri May 28, 2004 10:12 am

Post by mm765 »

you need to check, if it is a keyeevent at all..could be a gui event or logevent or whatever.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Maybe you should have a look on this thread:
http://irrlicht.sourceforge.net/phpBB2/ ... sc&start=0
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Dingsi
Posts: 6
Joined: Thu Sep 30, 2004 8:17 pm
Location: Hannover, Germany
Contact:

Post 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.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post 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...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply