home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!scifi!acheron!philabs!linus!agate!dewey.soe.berkeley.edu!werner
- From: werner@dewey.soe.berkeley.edu (John Werner)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Arcade-style animation...
- Date: 27 Jan 1993 20:02:29 GMT
- Organization: School of Education, U.C. Berkeley
- Lines: 42
- Message-ID: <1k6pol$bvn@agate.berkeley.edu>
- References: <1993Jan23.014127.5750@cs.ucla.edu> <1993Jan25.094256.12845@rulway.LeidenUniv.nl> <34994@goofy.apple.COM>
- NNTP-Posting-Host: dewey.soe.berkeley.edu
-
- In article <34994@goofy.apple.COM> Christopher Russo writes:
- >In article <1993Jan25.094256.12845@rulway.LeidenUniv.nl> Theo Vosse writes
- >>Life is simple... Forget the UpdateScreen function, and implement the
- >>EraseSprite as a copy of the old contents (that were stored under the
- >>sprite) back to its original position. So, DrawSprite must copy the
- >>contents of the sprite's position before drawing the actual sprite.
- >
- >Unless you have sprites overlapping each other, which would lead to some
- >ugly flicker and possibly a mess on the screen. You'll probably want to
- >handle overlapping sprites as a special case. Oh, and get that 'update the
- >entire screen during refresh' idea out of your mind completely unless you
- >have the secret of Mac page-flipping.
-
- Do people think it's worth bothering with synchronizing with the VBL
- when drawing sprites? I'm writing a physics simulator with some
- game-like aspects, and my animation currently goes something like
- this:
-
- repeat {
- calculate new position of each sprite
- wait for VBL interrupt
- erase all sprites by copying from offscreen bitmap holding background
- draw all sprites
- }
-
- It's actually a little more complicated, because sometimes one of the
- objects in the background changes too, and then I have to redraw the
- background's offscreen bitmap too.
-
- I'm getting good performance on my Quadra (of course), but things can
- get a little ugly on slower Macs. I think what's happening is that
- the "erase all sprites then draw all sprites" steps are taking longer
- than the time when the electron beam isn't drawing. Would I be better
- off forgetting about the VBL interrupts?
-
- As an aside, does anyone know about how much time there is between
- screen refreshes on "average" monitors? I know my monitor gets
- refreshed about 75 times per second, but I want to know how much
- drawing time I have before the next refresh starts.
- --
- John Werner werner@soe.berkeley.edu
- UC Berkeley School of Education (510) 596-5868 (new number)
-