Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members

AnimFrames Class Reference

Collaboration diagram for AnimFrames:

Collaboration graph
[legend]
List of all members.

Detailed Description

AnimFrames manages the frames of an animated Sprite.

Each Sprite is associated with an instance of AnimFrames. Several Sprites may share the same instance of AnimFrames if they have the same appearance. This is recommended, since it saves valuable resources.
All frames within an AnimFrames object share the same size, the same hotspot and the same mode of drawing.

Definition at line 46 of file SpriteEngine.h.

Public Member Functions

 AnimFrames (const Canvas *canvas, UInt16 numFrames, DmResID bitmapID, DmResID maskID, Coord hotSpotX=0, Coord hotSpotY=0) SEC_RAZOR_INIT
 Create an instance of a transparent AnimFrames.

 AnimFrames (const Canvas *canvas, UInt16 numFrames, DmResID bitmapID, Coord hotSpotX=0, Coord hotSpotY=0) SEC_RAZOR_INIT
 Create an instance of an opaque (not transparent) AnimFrames.

 ~AnimFrames () SEC_RAZOR_INIT
 Destroy the AnimFrames and deallocate all used resources.

Boolean getBounds (Coord x, Coord y, RectangleType *bounds) const
 Get the screen space filled by the AnimFrames when it is placed at the specified coordinates.

void draw (UInt16 index, Coord x, Coord y, RectangleType *bounds=NULL) const SEC_RAZOR
 Draw a frame at the specified location.


Friends

class Sprite


Constructor & Destructor Documentation

AnimFrames::AnimFrames const Canvas   canvas,
UInt16    numFrames,
DmResID    bitmapID,
DmResID    maskID,
Coord    hotSpotX = 0,
Coord    hotSpotY = 0
 

Create an instance of a transparent AnimFrames.

The frames will be constructed from bitmap resources in a resource database. The bitmap families for the frames need to be stored at IDs bitmapID..(bitmapID + numFrames) - 1. The 1bpp bitmaps for the transparency masks need to be stored at IDs maskID..(maskID + numFrames) - 1.

Parameters:
numFrames the number of frames
bitmapID the ID of the first image bitmap in the resource database.
maskID the ID of the first mask bitmap in the resource database
hotSpotX the horizontal offset of the hotspot.
hotSpotY the vertical offset of the hotspot.

AnimFrames::AnimFrames const Canvas   canvas,
UInt16    numFrames,
DmResID    bitmapID,
Coord    hotSpotX = 0,
Coord    hotSpotY = 0
 

Create an instance of an opaque (not transparent) AnimFrames.

The frames will be constructed from bitmap resources in a resource database. The bitmap families for the frames need to be stored at IDs bitmapID..(bitmapID + numFrames) - 1.

Parameters:
numFrames the number of frames
bitmapID the ID of the first image bitmap in the resource database.
hotSpotX the horizontal offset of the hotspot.
hotSpotY the vertical offset of the hotspot.

AnimFrames::~AnimFrames  
 

Destroy the AnimFrames and deallocate all used resources.


Member Function Documentation

Boolean AnimFrames::getBounds Coord    x,
Coord    y,
RectangleType *    bounds
const
 

Get the screen space filled by the AnimFrames when it is placed at the specified coordinates.

Parameters:
x the x coordinate
y the y coordinate
bounds a pointer to a rectangle which will be filled with the screen space filled by the AnimFrames.
Returns:
True, if the frame is completely off the screen, False if it is at least partially on the screen

void AnimFrames::draw UInt16    index,
Coord    x,
Coord    y,
RectangleType *    bounds = NULL
const
 

Draw a frame at the specified location.

Caution: Although this operation is publically accessible, you should know exactly what you are doing when you attempt to use it directly!!!

Parameters:
index the index of the displayed frame (0..numFrames).
x the x coordinate
y the y coordinate
bounds a pointer to a rectangle which will be filled with the screen space filled by the frame, or NULL.


Friends And Related Function Documentation

friend class Sprite [friend]
 

Definition at line 131 of file SpriteEngine.h.


The documentation for this class was generated from the following file:
Razor! Engine Developer's Guide. Copyright © by Tilo Christ. All Rights Reserved. Last updated: 31 May 2003