Page 1 of 1

GUI HUD ignores mouse

Posted: Sun Jan 08, 2012 8:04 am
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

Re: GUI HUD ignores mouse

Posted: Sun Jan 08, 2012 12:44 pm
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.

Re: GUI HUD ignores mouse

Posted: Mon Jan 09, 2012 5:40 am
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

Re: GUI HUD ignores mouse

Posted: Mon Jan 09, 2012 6:03 pm
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 :)