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