Layers
The Layer class is an abstract class that represents a basic visual entity that can be rendered on the screen. A Layer has defined rectangular bounds, and it can be either visible or invisible. A Layer can be rendered using any Graphics object by calling its paint method.
The game API defines two Layer subclasses: Sprite and TiledLayer. Unfortunately, class Layer cannot be directly subclassed by the developers, since this would compromise the ability to improve performance through the use of native code in the implementation of the Game API.
Subclasses of class Layer can be drawn at any time using the paint method. The Layer will be drawn on the Graphics object according to the current state information maintained by the Layer object (that is, position, visibility, and so forth.) The Layer object is drawn at its current position relative to the current origin of the Graphics object. Erasing the Layer is always the responsibility of the code outside the Layer class.
 |