[comp.sys.mac.programmer] MF compatibility using both screen buffers

goldman@Apple.COM (Phil Goldman) (03/14/88)

In article <2145@polya.STANFORD.EDU> rwilson@polya.stanford.edu () writes:
>I am about to release a PD video game that I would like to make
>multifinder compatible.  It works fine on a Mac II; and on a Plus or SE
>most of the time.  The problem is that on the 68000 machines I need the
>speed of page flipping, and am using the whole screen including menu bar
>and the secondary graphics screen.  First, does anyone know how to get a
>window to overlay the menu bar?

There isn't anything that's very clean, but there are a couple of things you
can do:
(1)  Set the menu bar height to 0.  HyperCard does this to get rid of the menu
bar.  Like HyperCard, your app will have to restore this when it gets a
suspend event (although if you get rid of the menu bar and your window covers
all others it might be difficult for the user to initiate a layer switch -- but
you should still handle all this).
(2)  Change the clipping in the wmgrport.  This is pretty gross, and could have
some nasty side effects.  Therefore, option (1) is much more preferable, given
that you're determined to do this.

Are you really sure that you want to get rid of the menu bar?  This has some
undesirable effects in terms of user interface, especially under MultiFinder.
At the very least, it would be nice to allow the user to decide whether the
menu bar is hidden.  In terms of page flipping, I think if you're tricky
enough you can still make the menu bar work correctly.

>Second, has anyone tried to make MF
>deal with the second screen?  I think I can accomplish the second if I
>get the first.

Actually, this is the tough task...really tough.  MultiFinder cannot allocate
a new screen (or sound) buffer at application launch time.  This was possible
in the old single application mode because the entire memory state above the
system heap was recreated from scratch each time.  The only way to really make
this work is to have an init that allocates the second buffer before MultiFinder
starts up.  This is difficult to write and forces the alternate buffer to
always be allocated.

Note that this is only a problem on MacPlus and SE; the page flipping on the
MacII is done differently (since you have to access the video driver on the
card directly).

A final note:  Your application would become *much* more compatible in all
respects if you could tune it to the point that you don't need to do page
flipping.  I guess that's become obvious just from the fact that my response
was pretty obtuse...or else it's just me.

-Phil Goldman
Apple Computer

rwilson@polya.STANFORD.EDU (Randy Wilson) (03/17/88)

>Note that this is only a problem on MacPlus and SE; the page flipping on the
>MacII is done differently (since you have to access the video driver on the
>card directly).

Luckily, the speed of the MacII makes page flipping unnecessary.  I have
time to draw in an offscreen bitmap and CopyBits it into a window,
making compatibility much easier.  Just for interest's sake, is there a
second page on the MacII, and how would one get at it?

Randy Wilson
wilson@polya.stanford.edu

stew@endor.harvard.edu (Stew Rubenstein) (03/21/88)

In article <2155@polya.STANFORD.EDU> rwilson@polya.UUCP (Randy Wilson) writes:
>>Note that this is only a problem on MacPlus and SE; the page flipping on the
>>MacII is done differently (since you have to access the video driver on the
>>card directly).
>
>Luckily, the speed of the MacII makes page flipping unnecessary.  I have
>time to draw in an offscreen bitmap and CopyBits it into a window,
>making compatibility much easier.  Just for interest's sake, is there a
>second page on the MacII, and how would one get at it?

You can't CopyBits a full-window 4-bit-deep PixMap onto the screen in
less than the refresh time, so if you don't want annoying artifacts,
you have to page-flip.  It is possible; it is done with Control calls
to the video driver.  See the "Cards and Drivers" book for details.  I
don't have mine in front of me, but a fully loaded Apple video card
has 512Kb, and there are 640*480 = 300K pixels.  Therefore, there is
enough memory for 1 8-bit page, 3 4-bit pages, 6 2-bit pages, or 13
1-bit pages.  Other video boards ought to support the same control
calls, but I haven't tested them.


Stew Rubenstein
Cambridge Scientific Computing, Inc.
UUCPnet:    seismo!harvard!rubenstein            CompuServe: 76525,421
Internet:   rubenstein@harvard.harvard.edu       MCIMail:    CSC