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

To initialize the animation system, call the system function InitGels().
It takes the form:

    struct VSprite  *vsHead;
    struct VSprite  *vsTail;
    struct GelsInfo *gInfo;

    InitGels(vsHead, vsTail, gInfo);

The vsHead argument is a pointer to the VSprite structure to be used as
the GEL list head.  (You must allocate an actual VSprite structure for
vsHead to point to.)  The vsTail argument is a pointer to the VSprite
structure to be used as the GEL list tail.  (You must allocate an actual
VSprite structure for vsTail to point to.)  The gInfo argument is a
pointer to the GelsInfo structure to be initialized.

InitGels() forms these structures into a linked list of GELs that is empty
except for these two dummy elements (the head and tail).  It gives the
head VSprite the maximum negative x and y positions and the tail VSprite
the maximum positive x and y positions.  This is to aid the system in
keeping the list sorted by x, y values, so GELs that are closer to the top
and left of the display are nearer the head of the list.  The memory space
that the VSprites and GelsInfo structures take up must already have been
allocated.  This can be done either by declaring them statically or
explicitly allocating memory for them.

Once the GelsInfo structure has been allocated and initialized, GELs can
be added to the system.  Refer to the setupGelSys() and cleanupGelSys()
functions in the animtools.c lisitng at the end of the chapter for
examples of allocating, initializing and freeing a GelsInfo structure.