Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!rosie!sstreep From: sstreep@next.com (Sam Streeper) Newsgroups: comp.sys.next Subject: Re: main event loop Message-ID: <370@rosie.NeXT.COM> Date: 11 Mar 91 17:04:46 GMT References: <228@qt.cs.utexas.edu> Sender: news@NeXT.COM Organization: Next Computer, Inc. Lines: 20 Nntp-Posting-Host: elvis.next.com In article <228@qt.cs.utexas.edu> tph@cs.utexas.edu (Pow-Hwee Tan) writes: > Does anyone know the innards of the main event loop in the "run" method >of Application class? I am trying to override the run method in my >Application subclass. > > Specifically, I would like a routine I wrote to be called each time >through the main event loop. I have tried using DPSAddTimedEntry with an >interval of 0, but the animation done by the routine called is still jerky. >While the 'jerkiness' may not be avoided totally with a heavy load, I would >still prefer a more direct call from the main event loop to my routine. You really don't want to override run. The jerkiness is not caused by the event loop, it is the result of your messages to the window server getting queued up, and then flushed all at once. To avoid this, use NXPing() after each animation frame. NXPing() forces the queue to get flushed, and you should get a smooth and fairly constant frame rate. You'll still want/need to make realtime corrections for system load, but that's another issue, unrelated to the jerkiness problem. -sam