I need to add some custom shape UI Buttons to my projects.
First thing that I had in my mind was to use a "Polygon2D", an attached script and handle input events as below:
if(event.type == InputEvent.MOUSE_BUTTON):
if(event.button_index == BUTTON_LEFT):
Everything is fine, except that I need to find when the mouse's cursor is only inside the polygon. Then I thought about triangulate the polygon and find out if the mouse's cursor is "in" a triangle or not (and, of course, parse the triangles within a for/while loop).
So I was wondering if there's another way to do this. Similar to the "mousepick_test" from the 3D demos, but in 2D and maybe using Polygon2D as a shape.
Here's an example of a shape of the button that I need: