GUI HUD ignores mouse

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
magicaxis
Posts: 12
Joined: Sun Jan 08, 2012 4:19 am

GUI HUD ignores mouse

Post by magicaxis »

Hello :)
I'm guessing this may be kind of a n00b question, but there's nothing about this in the tutorials :oops:

I'm making my first game in Irrlicht, and RTS, with mouse control:
Image

and when you select a tile (by clicking on it) it lights up and some gui button appear on the screen (not in a gui window mind you, I like it this way):
Image

However, since i switched to mouse control, the buttons wont register my mouse clicks, the click goes straight through to the tile behind the button and selects that instead:
Image

Is there a way I can say "Buttons get top priority for clicks"?
I'm using MyEventReceiver, which i've messed around with to accept mouse clicks and that.
I get that this would probably not be a problem if i put the buttons in a window, but I really dont wanna have to do that.
Thanks a bunch :D
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: GUI HUD ignores mouse

Post by serengeor »

magicaxis wrote: I'm guessing this may be kind of a n00b question, but there's nothing about this in the tutorials :oops:
Tutorials can't cover every scenario possible.
magicaxis wrote: Is there a way I can say "Buttons get top priority for clicks"?
It's up to you to think out a way which would let you do as you want. I can only suggest to try for example to only let select tile when no gui element is hovered (look up on documentation how to get what element is hovered), and also maybe gui is not receiving events, because your receiver returns true on mouse events. Other receivers (gui and other things have their own) will not receive events for which you return true in your receiver.

I actually had sort of similar problem myself. The buttons were getting events, but I could also select things in my editor while pressing those gui buttons, which is not that good if you want to interact with gui.
Working on game: Marrbles (Currently stopped).
magicaxis
Posts: 12
Joined: Sun Jan 08, 2012 4:19 am

Re: GUI HUD ignores mouse

Post by magicaxis »

Thanks man, that helps heaps. I turned off all the return trues in the event reciever, and made my program ignore mouse activity in the 3d realm once the mouse's position entered the GUI area <3
shadowghost21
Posts: 56
Joined: Wed Nov 23, 2011 11:53 pm

Re: GUI HUD ignores mouse

Post by shadowghost21 »

Yeah serengeor's solution is what CuteAlien suggested for the same problem I was having. I just posted about this a few days ago. Like the look of your game :)
Post Reply