Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!agate!scam!scott From: scott@scam.Berkeley.EDU (Scott Silvey) Newsgroups: comp.sys.mac.programmer Subject: Tracking the mouse. Keywords: Interrupts Mouse Tracking Message-ID: <1990Oct31.100603.1989@agate.berkeley.edu> Date: 31 Oct 90 10:06:03 GMT Sender: usenet@agate.berkeley.edu (USENET Administrator) Reply-To: scott@xcf.berkeley.edu Organization: UC Berkeley Experimental Computing Facility Lines: 52 I have just written and debugged my very first Macintosh application! It is a simple program which allows you to draw a lot of squiggly lines wherever you drag the mouse. My problem is that when the user is drawing, the lines come out a bit too squiggly. The mouse skips about erratically like it does when the wait cursor shows as the Mac is doing intensive disk I/O. When the mouse accelleration is high, this problem is the most pronounced, while it is reduced when I set the accelleration to 'graphics tablet' mode. Since I may someday wish to make a serious application which tracks the mouse smoothly, I find this behaviour rather annoying. MacPaint and other similar programs don't seem to have this trouble, so I can only assume I am going about the problem in a manner that is perhaps too brutish. My speculation is that Mac is going off on some interrupt every few seconds or so, resulting in the cursor movement being interpolated over the period of time in which the interrupt is being serviced. Now, I don't even know if the Mac even DOES such things ... I'm only guessing. Does anyone out there perhaps have an idea of what the problem is? Does anyone have code that work as it smoothly tracks the mouse? I have a Mac SE, I'm using LSC 3.0, and I am NOT using MultiFinder. Here is the code I use to do the drawing: do_line(theEvent) EventRecord *theEvent; { Point p; p = theEvent->where; GlobalToLocal(&p); MoveTo(p.h, p.v); do { LineTo(p.h, p.v); GetMouse(&p); } while (StillDown()); save_image(); } I would appreciate any help you could give me. Thanks, Scott