[comp.sys.amiga] InitAnimate and animation functions

MFM1%LEHIGH.BITNET@ibm1.cc.lehigh.edu (mark masters) (09/01/89)

I'm working on a program which uses the Amiga animate functions, however
I have run into a problem which is driving me nuts.  How do you use the
InitAnimate macro.  I cannot figure out how or where to use it.  The
only place I've seen it mentioned is in the Programmers handbook.  Any
help will be appreciated just so I can get this out of my head!!!

Are the animation functions explained in a better fashion in the Addison
Wesley(sp?) manuals?  If so I will promptly go out and place an order
for the ones which are ready.
Thanks in advance,
Mark
<mfm1@lehigh>

rap@peck.ardent.com (Rob Peck) (09/06/89)

In article <22985@louie.udel.EDU> MFM1%LEHIGH.BITNET@ibm1.cc.lehigh.edu (mark masters) writes:
>
>I'm working on a program which uses the Amiga animate functions, however
>I have run into a problem which is driving me nuts.  How do you use the
>InitAnimate macro.  I cannot figure out how or where to use it.  The
>only place I've seen it mentioned is in the Programmers handbook.  Any
>help will be appreciated just so I can get this out of my head!!!

Here are a couple of ->pieces<- extracted from an article that will appear in
the next issue of Compute's Amiga Resource, in the column "ASK ROB PECK"
:-) :-) :-) :-) 

=====================================
struct AnimOb *aKey;

struct AnimOb **animKey;

struct RastPort *srp;
struct AnimOb *animob0;


main()
{
...
...
    animKey = &aKey;
    InitAnimate(animKey);

    /* alternative to InitAnimate(animKey) is:
     *
     *             aKey = NULL;
     *
     * which is what the InitAnimate(x) macro expands to.
     */
    ...
    ...
    AddAnimOb(animob0, animKey, srp);
    ...
    ...
    Animate(animKey, srp);
    ...
    ...
}

=====================================
animKey is a pointer-to-a-pointer to an AnimOb.

   [Almost all of the other Amiga exec and system
    functions accept a pointer to a data structure
    where this one accepts a pointer-to-a-pointer-to;
    in fact, I cannot remember offhand any other
    function that needs this kinda pointer, (APTR's
    don't count).   BUT, at least it is consistent
    that both AddAnimOb and Animate take the same
    kinda thing].

You carefully initialize all of the data structures
that comprise an AnimOb (with its AnimComps), then
one by one add the animobs to a list, using the
AddAnimOb function.   The GEL (Graphics Element) system
accepts this animKey and modifies the pointer to which
it points to be the address of the animob most recently
added to the list.  The value of the pointer to which
animKey points in the beginning must be NULL.  That is
the purpose of the InitAnimate function.

There has been no change (that I am aware of) in the
description of the animation functions since the initial
release of the 1.1 ROM Kernel Manual.  That is, the 1.1
(white cover) and the 1.2 (White with colored stripe/
Addison Wesley official version) Animation chapter are
identical.  If you want to use the Animation functions,
you have to read about them there.  No doubt there will
be expanded explanations in a future edition of the
Exec/Libraries/Devices/Intuition book, but we'll just
have to wait and see about that.

Rob Peck