Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!markv From: markv@kuhub.cc.ukans.edu Newsgroups: comp.sys.amiga.programmer Subject: Re: Implementing moving crosshair... Message-ID: <1991Mar22.122651.29232@kuhub.cc.ukans.edu> Date: 22 Mar 91 18:26:51 GMT References: <1991Mar22.151348.23800@decuac.dec.com> Organization: University of Kansas Academic Computing Services Lines: 49 In article <1991Mar22.151348.23800@decuac.dec.com>, baker@wbc.enet.dec.com writes: > -Message-Text-Follows- > > Given an Intuition window, I want a pair of lines -- one running > from the top to the bottom of the window, the other running from > the left edge to the right edge. The intersection point of the > lines should track the mouse. > > I'm concerned about keeping up with all the MOUSEMOVE's, so I'm > looking for the most efficient way to implement the cross-hair > lines themselves. I can use either a Bob for each line, or I can > Draw the lines in COMPLEMENT and move them myself. Is the use of > a Bob going to make any real difference ? I think for this a BOB would be harder and slower. I would draw the lines in COMPLEMENT (using COMPLEMENT again to remove them of course), and special case the code to only redraw the cross-hairs if they've moved and only 3-5 times a sec (the user wont need any more often, but MOUSEMOVE can spew a lot faster). I do something similar for another program. I've also seem some machines have a fair bit of "jitter" in the mouse values (it seems to be related to the physical values in the mouse XY registers being a bit touchcy), so I also use a running average of the last few (4) values. Four was picked because I can keep the running average with integer arithmatic: NewAvg = ((OldAvg * 3) + NewVal) >> 2; or for the speed obsessed: NewAvg = ((OldAvg << 1) + OldAvg + NewVal) >> 2; > Also, I'd be interested in any suggestions that would speed up > tracking on rubber-band lines and stretchable bounding-boxes. Same rules, keep down the number of draws. Also, pick the color with complement mode so that you only have to flip bits in one-bitplane. (JAM1, Color 0 or 1 works well). > Thanks much. > Art Baker -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: mgooderum \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: markv@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~