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

The AnimOb and AnimComp structures can include pointers for your own
routines that you want the system to call.  These pointers are stored in
the AnimOb's AnimORoutine field and in the AnimComp's AnimCRoutine field,
respectively.

When Animate() is called, the system performs the following steps for
every AnimOb in the AnimKey list:

    * Updates the AnimOb's location and velocities.

    * Calls the AnimOb.AnimORoutine routine if one is supplied.

    * The for each AnimComp of the AnimOb:

         · If this sequence times out, switches to the new AnimComp.

         · Calls the AnimComp.AnimCRoutine if one is supplied.

         · Sets the underlying VSprite's x,y coordinates.

If you want a routine to be called, you put the address of the routine in
either AnimComp.AnimCRoutine or AnimOb.AnimORoutine member as needed.  If
no routine is to be called, you must set these fields to NULL.  Your
routines will be passed one parameter, a pointer to the AnimOb or AnimComp
it was related to.  You can use the user structure extensions discussed
earlier to hold the variables you need for your own routines.

For example, if you provide a routine such as this:

    VOID MyOCode(struct AnimOb *anOb)
    {
    /* whatever needs to be done */
    }

Then, if you put the address of the routine in an AnimOb structure:

    myAnimOb.AnimORoutine = MyOCode;

MyOCode() will be called with the address of this AnimOb when Animate()
processes this AnimOb.