[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

For double-buffering, a place must be provided for the system to store the
extra information it needs.  The system maintains these data, and does not
expect the application to change them.  The DBufPacket structure consists
of the following members:

BufY, BufX  Lets the system keep track of where the object was located
            in the last frame (as compared to the Bob structure
            members called OldY and OldX that tell where the object
            was two frames ago).  BufY and BufX provide for correct
            restoration of the background within the currently active
            drawing buffer.

BufPath     Assures that the system restores the backgrounds in the
            correct sequence; it relates to the VSprite members
            DrawPath and ClearPath.

BufBuffer   This field must be set to point to a buffer the same size
            as the Bob's SaveBuffer.  This buffer is used to store the
            background for later restoration when the system moves the
            object.  This buffer must be allocated from Chip memory.

To create a double-buffered Bob, execute a code sequence similar to the

    struct Bob        myBob = {0};
    struct DBufPacket myDBufPacket = {0};

    /* Allocate a DBufPacket for myBob same size as previous example */
    if (NULL != (myDBufPacket.BufBuffer = AllocRaster(48, 20 * 5)))
        /* tell Bob about its double buff status */
        myBob.DBuffer = myDBufPacket;

The example routines makeBob() and freeBob() in the animtools.c listing at
the end of this chapter show how to correctly allocate and free a
double-buffered Bob.

[Back to Amiga Developer Docs]