mjhostet@athena.mit.edu (Mat J Hostetter) (06/28/90)
I am new to the Mac, but I am an experienced C and assembly programmer on other machines. I am porting over a game I wrote to the Mac, and I need some way to do really fast graphics. I need to be able to display small ( < 16x16) geometric figures, replacing whatever is underneath them. I played around with CopyBits, and got it to work, but it is not fast enough. I am also considering writing directly to the grafPort's portBits area, but I am concerned about making this run on both color and monochrome Macs. Anyway, my question is, what's the *RIGHT* way to draw these shapes on this machine? Please reply by email, as I can't read this group often, but you might as well post if you have something Wise to say. And sorry if you have discussed this any time in the past-- I missed it. Thanks, Mat Hostetter
jackiw@cs.swarthmore.edu (Nick Jackiw) (06/28/90)
mjhostet@athena.mit.edu (Mat J Hostetter) writes: > I need some way to do really fast graphics. I need to be able to display > small ( < 16x16) geometric figures, replacing whatever is underneath them. > I played around with CopyBits, and got it to work, but it is not fast > enough. I am also considering writing directly to the grafPort's > portBits area, but I am concerned about making this run on both color > and monochrome Macs. Anyway, my question is, what's the *RIGHT* way to > draw these shapes on this machine? > > Mat Hostetter While you can write directly to the screen, you'll rapidly find that you're simply reimplementing CopyBits. You need to worry about clipping, pixel depths, video layout, etc. Worse, while if internals change, you can count on CopyBits changing, you can't count on your own custom code magically self-modifying. Intelligent use of CopyBits is very fast: you can easily get 30 frames/ second on a 16x16 image with background masking if you set things up right. Aligning bits between your source & destination images is necessary, as well as having your offscreen images at the appropriate depth. Tech Note #277, "Of Time and Space and _CopyBits" outlines all of the major ways of speeding CopyBits. It's available FTP from apple.com. -- _ _|\____ Nick Jackiw | Visual Geometry Project | Math Department / /_/ O> \ ------------+-------------------------+ Swarthmore College | O> | 215-328-8225| jackiw@cs.swarthmore.edu| Swarthmore PA 19081 \_Guernica_/ ------------+-------------------------+ USA