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

The collision handler table is a structure, CollTable, defined in
<graphics/gels.h>.  It is accessed as the CollHandler member of the
GelsInfo structure.  The table only needs to be as large as the number of
bits for which you wish to provide collision processing.  It is safest,
though, to allocate space for all 16 entries, considering the small amount
of space required.

Call the routine SetCollision() to initialize the table entries that
correspond to the HitMask and MeMask bits that you plan to use.  Do not
set any of the table entries directly, instead give the address to
SetCollision() routine and let it handle the set up of the
GelsInfo.CollTable field.

For example, SetCollision() could be called as follows:

    ULONG            num;
    VOID           (*routine)();
    struct GelsInfo *GInfo;

    VOID myCollisionRoutine(GELA, GELB)   /* sample collision routine */
    struct VSprite *GELA;
    struct VSprite *GELB;
    {
        /* process gels here - GELA and GELB point to the base VSprites */
        /* of the gels, you can use the user extensions to identify what */
        /* hit (if you need the info). */
    }

    /* GelsInfo must be allocated and initialized */

    routine = myCollisionRoutine;

    SetCollision(num, routine, GInfo)

The num argument is the collision table vector number (0-15).  The
(*routine)() argument is a pointer to your collision routine.  And the
GInfo argument is a pointer to the GelsInfo structure.


[Back to Amiga Developer Docs]