Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!bionet!agate!stanford.edu!neon.Stanford.EDU!egret.Stanford.EDU!espie From: espie@egret.Stanford.EDU (Marc Espie) Newsgroups: comp.sys.amiga.programmer Subject: Re: Implementing moving crosshair... Message-ID: <1991Mar22.221425.3564@neon.Stanford.EDU> Date: 22 Mar 91 22:14:25 GMT References: <1991Mar22.151348.23800@decuac.dec.com> <1991Mar22.122651.29232@kuhub.cc.ukans.edu> Sender: news@neon.Stanford.EDU (USENET News System) Organization: LIENS, ENS, 45 rue d'Ulm, Paris (France) Lines: 57 In article <1991Mar22.122651.29232@kuhub.cc.ukans.edu> markv@kuhub.cc.ukans.edu writes: >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). ---------- this is the interesting point. [some more interesting comments deleted] > >> 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 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Instead of using MOUSEMOVE, in many cases, you can just ask for INTUITICKS. IntuiMessages have the current position of the mouse stamped in MouseX/MouseY. For many applications (rubber band boxes for instance), that is largely sufficient, and it does reduce the traffic to less than ten messages par seconds. Also, an INTUITICKS message gets posted only if you haven't used the previous one. This means that whatever you do, you can always keep up with whatever Intuition sends you. That's already less messages than MOUSEMOVE, and the MouseX/MouseY fields are completely reliable. If you're using COMPLEMENT mode, you still have to trim down the number of messages (check the time signature) or else the rubber-band frame will flicker. Personnally, I obtain best results with a rate of 2 or 3 redraws per second for a rubber band. I wouldn't know for a cross-hair. You can also mask off some bitplanes in your drawing area. After all, you only need one bitplane to be able to see the moving frame. This is a very effective optimization. I haven't checked if the line drawing routines recognize horizontal/vertical lines. If they don't DrawRectangle() might be faster :-) You should have no problem drawing a nice crosshair using that. I used the same technic to draw a SOLID rubber box. -- Marc (espie@flamingo.stanford.edu) no .sig today.