[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.