device window handle device.OnEvent isn't working

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
specht8
Posts: 11
Joined: Mon Aug 09, 2010 2:07 pm

device window handle device.OnEvent isn't working

Post by specht8 »

Hi,

I have my irrlicht window integrated into a from window but when i press a button or use the mouse the window receives the event insted of the irrlicht device.

can someone help me with this? Is it possible to forward events from the form to the irrlicht device?

thanks
CuteAlien
Admin
Posts: 9934
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

The IrrlichtDevice has a function postEventFromUser which can be used for that. Basically you create for each event which you want to pass on a corresponding irr::SEvent and pass that to the device.

For example for mouse-move you create a EET_MOUSE_INPUT_EVENT with EMIE_MOUSE_MOVED as MouseInput.Event. Then set X, Y, Shift and Control for the MouseInput structure (in SEvent) and pass it to the device. Similar for mouse-clicks and key-pressed.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply