Jump to content
  • Advertisement
Sign in to follow this  
suliman

Clickable custom-shaped area

This topic is 2770 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
(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
well i need to define the region ingame so setting a number of points (forming a polygon) is probably a good solution.
Thanks
E

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!