Preventing GUI Click Through

I have been searching on ways to prevent GUI clickthrough from occuring, it’s easy enough to do it for GUI buttons, but doing it for your other GUI elements like textures with no input seems a bit trickier.

Just wondering if there are any new methods to handle this? Previous methods in general seem to revolve around storing the Rects of your GUI elements, and then checking if the mouse was in one of those rects when it was clicked.

So, is this still the best way to prevent clickthrough?

One Issue I have with this, is that many of our GUI elements are circular as opposed to rectangles, so detecting rects isn’t exactly accurate.

Is there any way I can check what texture I am clicking, and then check if the part of that texture I clicked on is transparent or not?

Thanks

Checking the distance between two objects isn’t particularly difficult (in fact the functionality is already built in for you) so storing the places and sizes of circles should be simple.

Yeah, I guess you could kind of store circle cooridinates and check them, but that was really just one example. Often interfaces have curves and that sort of stuff that would be very difficult to calculate - and it would be a very manual process that could cause problems, particularly with a draggable interface.

hmm…

Assuming there is no better solution (I haven’t mucked around with GUI yet) and probably assuming your not on an iphone…

You could possibly take a SS of the screen with only gui elements showing, and then query this to see if the mouse click is on a gui or background.

Just update the SS when the screen size changes or when gui elements change.

To improve performance you can change how the ‘SS’ is taken, how the data is stored etc…

Scratch that, given the same assumptions you want to do it like physics - keep with AABB (box) detection, and then figure out a more accurate version (like pixel perfect CD) for non-primitive shapes.

Yeah this won’t be for an iphone, so we can explore the more “hungry” solutions as well.

I have played around with checking for alpha pixels on GUI textures that the mouse is over - it works well, not sure what sort of performance impact it will have in the long run though.