home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 22290 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  2.5 KB

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