OnEvent question ...

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
Guest

OnEvent question ...

Post by Guest »

I'm wondering why OnEvent returns a value. In my event handler I need to take care of keyboard, mouse, and gui ... and I put them in that order when processing them also. It seems if I return true when finished anything gui will stop working or mouse, or keyboard will stop working. However, if i just always return false, everything works perfectly fine.

I'm conufsed here. What part of the irrlicht engine uses the value returned from OnEvent? How should I be organizing my code within the OnEvent method?

Thank you for any help in advance.
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

The meaning of the return value of OnEvent is "absorbed". If you return true, then you "absorb" the event and no other event receiver (like gui elements, or fps cam etc.) will receive it.

The default return value should be false. You return true in at least two cases:

1. You handle the event and know that the event will not be used by the engine (this also removes some overhead).

2. You handle the event and don't want the engine to further process the event.

Normally you return true if you do something with a specific event (e.g. button pressed). Sometimes you return false (e.g. read mouse position).
It is like it is. And because it is like it is, things are like they are.
Post Reply