I'm doing interrupt driven programming, so as to secure non-flickering animation that's fast enough. I'm very close to my goal now. Basically, all compact macs have a 60.15 Hz refresh rate, which means that the screen is drawn every 16.6 milliseconds (ms). The first 15.3 ms are used by the electron beam to draw the actual screen from top left to bottom right (passing each line horizontally from left to right) and the remaining 1.3 ms is used to "vertical blank", ie to return to the top left.

The timing of my C function that draws small sprites (my own object that uses bitmaps and several other stuff from the Mac librairies) takes around 0.5 ms roughly. There is a way to give the drawing function a time cue so that it acts precisely when the screen-refreshing beam is starting to do its vertical blanking. However, since the operation takes 1.3 ms, you can't fit a lot of 0.5 ms sprites, especially if they're near the top of the screen. If a sprite is drawn while the beam is partially past it, flicker occurs. Fortunately, I can use the vertical blanking as a mere time signal, and start other, finer timers to produce cues when the electron beam is at other places (such as the middle of the screen, for example). Generally, you want to draw sprites right behind the beam to avoid flickering as much as you can.

I've never had to deal with this in modern machines (ie the DOS tests I did a few years ago), where you just have a secondary buffer (or even tertiary as well) for the screen bitmap, and the computer + video cards are fast enough to draw these whole buffers at once, removing the need to bother with too much timing. This has forced me to learn an old aspect of programming that every game developper has dealt with, especially in the old consoles and comps.


-- System6 is sponsored by <http://lowendmac.com/> and...

123Inkjets.com <http://lowendmac.com/ad/123inkjets.html>

     Support Low End Mac <http://lowendmac.com/lists/support.html>

 System 6 Heaven <http://www.euronet.nl/users/mvdk/system_6_heaven.html>

System6 info:           <http://lowendmac.com/lists/system6.html>
 --> AOL users, remove "mailto:";
Send list messages to:  <mailto:system6@mail.maclaunch.com>
To unsubscribe, email:  <mailto:[EMAIL PROTECTED]>
For digest mode, email: <mailto:[EMAIL PROTECTED]>
Subscription questions: <mailto:[EMAIL PROTECTED]>
Archive: <http://www.mail-archive.com/system6%40mail.maclaunch.com/>

iPod Accessories for Less
at 1-800-iPOD.COM
Fast Delivery, Low Price, Good Deal
www.1800ipod.com

Reply via email to