Previous Book Contents Book Index Next

Inside Macintosh: Apple Game Sprockets Guide /
Chapter 2 - DrawSprocket / DrawSprocket Reference
DrawSprocket Functions / Drawing and Double Buffering


DSpContext_GetBackBuffer

The DSpContext_GetBackBuffer function returns the back buffer for the context, which is where the game should image to. The back buffer is the next buffer that will be displayed on a call to DSpContext_SwapBuffers.

OSStatus DSpContext_GetBackBuffer (
DSpContextReference inContext,
DSpBufferKind inBufferKind,
CGrafPtr *outBackBuffer);
inContext
A reference to the context whose back buffer is to be returned.
inBufferKind
The kind of buffer. Currently the only supported buffer kind is kDSpBufferKind_Normal.
outBackBuffer
On exit, a pointer to the back buffer.
function result
A result code.
DESCRIPTION
The DSpContext_GetBackBuffer function returns, in the outBackBuffer parameter, a graphics pointer designating a graphics port containing the back buffer of the context specified in the inContext parameter. Your game should draw to that back buffer. You specify the kind of buffer in the inBufferKind parameter, although currently the only supported buffer kind is kDSpBufferKind_Normal.

The pointer to the back buffer may change after a call to DSpContext_SwapBuffers, so you must call this function before rendering every frame.

If you have specified an underlay for the context, the back buffer will have the underlay image restored before this call returns.

If there are no available back buffers (they are all queued up for display), this function will block until one is available. To avoid blocking, call DSpContext_IsBusy (page 2-52) until it returns false.

CALLING RESTRICTIONS
Do not call this function during an interrupt.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996