home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / next / programm / 5630 < prev    next >
Encoding:
Internet Message Format  |  1992-08-14  |  2.4 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!ames!pacbell.com!well!moon!pixar!rosie!NeXT.com
  2. From: sam_s@NeXT.com (Sam Streeper)
  3. Newsgroups: comp.sys.next.programmer
  4. Subject: Re: Animating lots of small bitmaps
  5. Message-ID: <4603@rosie.NeXT.COM>
  6. Date: 13 Aug 92 01:20:02 GMT
  7. References: <22171@venera.isi.edu>
  8. Sender: news@NeXT.COM
  9. Reply-To: sam_s@NeXT.com
  10. Distribution: usa
  11. Lines: 49
  12.  
  13. In article <22171@venera.isi.edu> dstrout@isi.edu (David Strout) writes:
  14. > I need to animate many (up to 40) small (48>x>20) bitmaps in a view
  15. > under 3.0.  (Think what the X game netrek looks like)  
  16.  
  17. Use NXImages to store your sprites, and then lockFocus on the appropriate
  18. View or NXImage to composite them in.  Also note whether your window
  19. is retained or buffered; if it's buffered you may need to flush frequently
  20. to prevent the dirty rect from getting too big; when this happens, flushing
  21. will become slower than necessary.  If it's retained you may need to pull
  22. some tricks so that the display doesn't flicker.
  23.  
  24. For an interesting experiment, run BoinkOut from the command line like this:
  25.  
  26. BoinkOut -NXShowAllWindows
  27.  
  28. This unsupported feature will show you what how the window server is cacheing
  29. all the images an app uses, and can be very edifying.  In the case
  30. of BoinkOut, I use a retained window and buffer everything myself in an
  31. NXImage.  Once the buffer is fully constructed, I can output the changed
  32. pieces of it without worrying about accumulating a large dirty rect.
  33. (This probably won't make any sense until you program something like it)
  34. You can get BoinkOut via ftp from (nova.cc.purdue.edu) or on the 3.0
  35. NeXTSTEP release.
  36.  
  37. > I tried doing
  38. > it with a subview per bitmap, but that flashed badly.
  39.  
  40. No doubt.  Not a good approach for fast animation.
  41.  
  42. > I tried putting
  43. > them all in the drawSelf:: of the main view, but that makes the whole
  44. > view flash.  
  45.  
  46. I recommend using your own optimized animation display methods that
  47. draw as little as possible.
  48.  
  49. > Current idea is to define a Type 3 font with my bitmaps,
  50. > then use xyshow to draw them.  This seems really gross.  If I wanted
  51. > to do graphics with fonts, I'd program (pick one: X, TI99/4a, IBM PCs)
  52.  
  53. This is fast, but is a big pain, and you can only output 1 color at a time.
  54. NXImage is much more appropriate.
  55.  
  56. -sam
  57.  
  58.  
  59. --
  60. Opinions are not those of my employer.  They're not even mine.  They're
  61. probably wrong besides.  How did they get in here, anyway?
  62.