🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #127

Re: Clicking on Irregular Shapes

#127
From: Steve Beats
Date: Wed, 21 Jun 1989 13:40
26 lines
1720 bytes
In article <42700015@m.cs.uiuc.edu> schwager@m.cs.uiuc.edu writes:
>
>Hope someone can help with this C question:
>
>Given an irregularly shaped object on a Screen, how can one tell if
>the mouse button has been pressed inside of it?  I don't want a box all
>around or inside it; I want the object and exactly the object.  
>
>.........................  I don't like the way collision detection is
>handled with Bobs, either (I was thinking of checking the collision of
>the mouse pointer with Bobs- but the way it's done, the collision
>borders for the Bob become a square, also).
>
>-Mike Schwager				schwager@a.cs.uiuc.edu

You were on the right track with the BOBs idea in the first place.  Although
the "hit box" is just that (a box), BOBs allow you to specify a hit mask
too.  You simply OR together all the planes of your country images (excluding
the borders in this case) and install them as the hit mask for the individual
BOBs.  Now, whenever a mouse click is detected inside the hit box, it is
further qualified by anding with the hit mask.  One caveat here, you will
have to make the mouse pointer into a BOB too.  BOB collision detect won't
work with the intuition mouse pointer.  Just turn it into a BOB with a single
pixel hit mask at the hot spot.

	Steve
Technical Details
Message-ID: <7110@cbmvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!oliveb!amiga!cbmvax!steveb
References: <42700015@m.cs.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!oliveb!amiga!cbmvax!steveb
From: steveb@cbmvax.UUCP (Steve Beats)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Clicking on Irregular Shapes
Message-ID: <7110@cbmvax.UUCP>
Date: 21 Jun 89 13:40:50 GMT
References: <42700015@m.cs.uiuc.edu>
Reply-To: steveb@cbmvax.UUCP (Steve Beats)
Organization: Commodore Technology, West Chester, PA
Lines: 26