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
Clickable custom-shaped area
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.
(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.
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.
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?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement