How to access SMouseInput from an IEventReceiver class

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
Tobias314
Posts: 10
Joined: Thu Oct 20, 2011 6:27 pm

How to access SMouseInput from an IEventReceiver class

Post by Tobias314 »

I'm attempting to get hardware mouse input, rather than the gui mouse cursor for a camera system I'm working on, but MastEventReceiver doesn't appear to compile properly (it usually complains that the int or s32 I'm using does not match the int or s32 I'm using in MastEventReceiver::, but it's for Irrlicht 1.3 so I'm not sure if there were input changes since then?).

How do I get input directly from the mouse in an IEventReceiver class without using the gui elements?
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Re: How to access SMouseInput from an IEventReceiver class

Post by Brainsaw »

Well ... if you want to get the mouse input inside the event receiver you have to process messages of type "irr::EET_MOUSE_INPUT_EVENT", then you can access the data with "event.MouseInput...". I guess it will not work if you try to access this data when you process other event types (though I never tried). If you need the mouse data every frame (imho e.g. useful for node picking) you can also use "irr::gui::ICursorControl" which can be accessed by "irr::IrrlichtDevice::getCursorControl".
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to access SMouseInput from an IEventReceiver class

Post by CuteAlien »

Like Brainsaw already wrote you can use ICursorControl. But why are you still using Irrlicht 1.3? I mean certainly there have been interface changes - we had 4 major releases since then!
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
Tobias314
Posts: 10
Joined: Thu Oct 20, 2011 6:27 pm

Re: How to access SMouseInput from an IEventReceiver class

Post by Tobias314 »

@Brainsaw, yeah I figured that one out. Somehow when I searched I didn't come across this tutorial (http://irrlicht.sourceforge.net/docu/example019.html), which give me quite a bit of insight. I've attempted to use the gui:: mouse, but I was having some issues with that (which may or may not have been related to my code), but then thought using a gui control element for something that has little to do with a gui seemed in appropriate.

@CuteAlien, I'm using 1.7.2, but MastEventReceiver was written for 1.3, which is why I was assuming the code I attempted to repurpose from it wasn't working.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to access SMouseInput from an IEventReceiver class

Post by CuteAlien »

Ah, I see. I don't know that one too well, but aren't there newer versions of it in the same thread?
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
Tobias314
Posts: 10
Joined: Thu Oct 20, 2011 6:27 pm

Re: How to access SMouseInput from an IEventReceiver class

Post by Tobias314 »

I honestly wasn't looking for a drop-in solution, I was more or less just looking for working code so I could understand the input system well enough and adapt it for my specific needs.

And in the event that someone stumbles upon this post in a search, looking for a drop-in solution, it would appear that the MastEventReceiver thread (http://irrlicht.sourceforge.net/forum/v ... hp?t=34071) at the time of this posting, has not been replied to, much less updated, since 2009.
Post Reply