Hovering a GUI Image. *Solved

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
Dirtbiker
Posts: 29
Joined: Wed Aug 31, 2005 7:02 am
Location: U.S.
Contact:

Hovering a GUI Image. *Solved

Post by Dirtbiker »

I am making GUI menu using GUI Images. I need to show text when an image is hovered. My problem is when I check if the GUI Image element ID is Hovered I get no response. I'm sure I have the correct ID.
Can a GUI Image be checked for hovering?
Thank you.

Image
Last edited by Dirtbiker on Sun Jul 30, 2006 9:09 pm, edited 1 time in total.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

How are you checking that the image is hovered? As far as I see, there is no way to check that a gui control is hovered. An event is generated, and you have to respond to the event that is passed to the user event receiver.

Travis
Dances
Posts: 454
Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:

Post by Dances »

I would personally just get the cursors position and compare it with the button's co-ords...
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

So you did something like this...

Code: Select all

const core::position2d<s32> mouse = //...
if (image.getAbsoluteRect().isPointInside(mouse))
{
  // do something
}
That should work to detect mousing over an image. The environment manager is already tracking the element that the mouse is over. If you receive messages with an event receiver, you can respond to the hover event.

Travis
Dirtbiker
Posts: 29
Joined: Wed Aug 31, 2005 7:02 am
Location: U.S.
Contact:

Post by Dirtbiker »

Thank you vitek and Dances. I just realized I was drawing the debug text before the scene. I am recieving Hovered event.
Post Reply