[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

Before you can use the GELs system, you must set up a playfield.  The GELs
system requires access to a view, viewport, and rastport structure.  these
structures may be set up through the grapics library or Intuition.  For
most examples in this chapter, the Intuition library is used for this
purpose.

All GELs have a vsprite structure at their core.  the system keeps track
of all the GELs that it will display (the active GELs) by using a standard
Exec list structure to link the VSprites.  This list is accessed via the
GelsInfo data structure, which in turn is associated with the rastport.
The GelsInfo structure is defined in the file <graphics/rastport.h>. when
a new GEL is introduced to the system, the new GEL is added immediately
ahead of the first existing GEL whose x, y value is greater than or equal
to that of the new GEL, always trying to keep the list sorted.

As GELs are moved about the screen, their x, y values are constantly
changing.  sortglist() re-sorts this list by the x, y values. (although
this is a list of vsprite structures, bear in mind that some or all may
really be Bobs or AnimComps.)

The basic set up of the gelsinfo structure requires three important
fields:  sprrsrvd,  gelhead and geltail.  the sprrsrvd field tells the
system which hardware sprites not to use when managing true VSprites.  For
instance, Intuition uses sprite 0 for the mouse pointer so this hardware
sprite is not available for assignment to a VSprite.  The gelHead and
gelTail are vsprite structures that are used to manage the list of gels.
They are never displayed.  To activate or deactivate a GEL, a system call
is made to add it to or delete it from this list.

Other fields must be set up to provide for collision detection, color
optimization, and other features.  A complete example for setting up the
gelsinfo structure is shown in the animtools.c lisitng at the end of this
chapter.

 initializing the gel system