Quick Links: Gideros Home | Download Gideros | Developer Guide
How to make button with non standard shape
  • Hi all!
    I'm a little bit confuse. I was trying to make a button with non standard shape (the shape that is hard to create using Path2D or Shape).
    I took image that has this shape. The image is, for example, 200x200 square with transparent parts.
    So, when I am using hitTestPoint function is says 'yes' for all 200x200 pixels of my image. I was trying to use setBlendMode with masking, but it didn't help me.

    I've managed to do this by using RenderTarget and modifying background of my image from transparent to black, but it doesn't seem to be the best way.
    Do you have any suggestions? Maybe I've missed some simple solution?

    P.S. My solution is in attachment
    test.zip
    5K
  • antixantix +1 -1
    Member
    @Fill_os_OFF if you check the alpha then you should be fine
      if alpha == 0 then
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • antix said:

    @Fill_os_OFF if you check the alpha then you should be fine

      if alpha == 0 then


    Thank you! yes, of course it will work too.
    But I want to ask if someone know any ways to do it without RenderTarget and checking the pixels?
  • keszegh +1 -1 (+1 / -0 )
    Member
    only RenderTarget has getPixel method, so i don't thinnk there is a simpler way.

    Likes: antix

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with OpenID

In this Discussion

Top Posters