Game Development Community

Transparent GUI parts not forwarding mouse events. [solved]

by Max Kielland · in Torque Game Builder · 01/25/2013 (7:41 am) · 6 replies

Hi,

So, I have my HUD, my tiles and my cursors. As you can see in the picture my HUD is not rectangular and the red area is the transparent part of my GuiBitmapCtrl bitmap. When I move my mouse over the red area the mouse events are not forwarded down to my tile layer below.

mkdevelopment.se/bitmaperror.png
I can understand why the messages isn't forwarded, but is there a good praxis on how to solve the problem? It must be possible to create a non rectangular HUD, or?!?

#1
01/25/2013 (7:54 am)
I ran into this issue as well and as far as I can tell no, there isn't a way to create non-rectangular GUI elements.

However it is possible to fake it by being clever. In this instance why not separate the top GUI bitmap into two distinct pieces? The user wouldn't know the difference and it would allow for nothing to be blocking the elements below.

i.imgur.com/olAnVor.jpg
Also remember that the order in which the elements appear in the GUI file control which "layer" they're on. Unless I'm missing something you could easily move the upper portion into the "back" as it were and no longer be blocking anything below it.
#2
01/25/2013 (8:10 am)
Thank you,
that was my second thought too. I guess I will redesign the HUD a bit to be constructed by rectangular shapes.

For a moment I was thinking about to capture the mouse events in the GUI and forward them down if I could figure out if the pixel was transparent.

Okay, back to Inkscape... :)
#3
01/25/2013 (10:44 am)
Modeless profiles....

If you create a profile for that control and set modeless=true; in it then mouse events pass through it.
#4
01/25/2013 (11:10 am)
Thanks @Richard,

...that might be a good trick to know.
In my case it isn't so good if the user by accident clicks on a tile he can't see under the HUD.

I will redesign my HUD a bit, I need to add some more options to it anyway.
#5
01/25/2013 (12:35 pm)
Oh that is a good thing to know. Thanks (yet again) for the Pro Tip!
#6
01/25/2013 (12:55 pm)
Well, if you do some weird stuff like using a GuiControl for a button instead of using a button and you put text on that "button" you want mouse clicks to pass through the text control, so you do stuff like create modeless text profiles.... You see what I mean? Weird. I don't know of there was an alpha release of the newer iteration of 3 Step Studio, but if there was and you saw it, then the panels in the Interface Editor use this trick a lot.