• Advertisement
Sign in to follow this  

Clickable custom-shaped area

This topic is 2554 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi
How do i set up a custom (polygon) area like in risk where you have regions and they are clickable?
Would i set up a series of points and see if mouse-cursor is "within" these or how do i go about this task?

Thanks a lot
Erik

Share this post


Link to post
Share on other sites
Advertisement
Try this Point in Polygon. Just test if your moues pointer is in a polygon. Implementing it is pretty strait forward and there are also some implementations floating around the Internet.

Share this post


Link to post
Share on other sites
(Assuming Windows API)
Rather than a polygon, you can use a "region". A region is any arbitrary size and shape, not just a polygon. You can load art and convert it to a region, or you can add and subtract shapes from a region. Then test if the point is within the region.

A Google search for region from bitmap gives a bunch of results about creating the region and using it for hit detection and other purposes.

Share this post


Link to post
Share on other sites
Maybe this is the same as region from bitmap, but could you just see what color is under the mouse, and have a different color for each region?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement