mouse hover effects

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
CaptainPants
Posts: 19
Joined: Wed Dec 06, 2006 10:15 am

mouse hover effects

Post by CaptainPants »

Hi there,

I was wondering if there is a good way to allow mouse over affects in the irrlicht GUI. Normally, when an element is 'focussed' no other elements receive EMIE_MOUSE_MOVED events (particularly, the Hovered element does not).

I *fixed* it by changing the CGUIEnvironment class's postEventFromUser method on line 508:

Code: Select all

// sending input to focus
if (Focus && Focus->OnEvent(event))
	return true;

// focus could have died in last call
if (/*!Focus &&*/ Hovered) // commented out the '!Focus &&' [508]
	return Hovered->OnEvent(event);
This sends EMIE_MOUSE_MOVED messages (and other mouse events) to the hovered element when their is no focussed element or it's OnEvent returns false....

Can anyone tell me what unexpected side-effects this will have? or if there is a better way?

Thanks guys
Last edited by CaptainPants on Sat Oct 20, 2007 3:15 am, edited 1 time in total.
~~Captain Pants
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I did it somewhat similar. Looks like that here:

Code: Select all

		if ( Hovered && Focus && Hovered != Focus && event.MouseInput.Event == EMIE_MOUSE_MOVED )
		{
			if ( Hovered->OnEvent(event) )
				return true;
		}

		// sending input to focus
		if (Focus && Focus->OnEvent(event))
			return true;

		// focus could have died in last call
		if (!Focus && Hovered)
			return Hovered->OnEvent(event);
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
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I just found out that with my solution menus do no longer work. To make them work again I had to return false when handling EMIE_MOUSE_MOVED in CGUIContextMenu.cpp. Which seems fine anyway as the menu has no reason to eat the event.
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
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Hey captain pants,

i dont know wat you are making with the GUI , but have a look at this menu here

http://old.owned.co.za/
http://irrlicht.sourceforge.net/phpBB2/ ... 3a523705c9

i used images and such and mouse over as well as keyboard react with a simple implementation.

I dunno if it helps i just remember long ago when i made it i found it useful

:)
Post Reply