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

AnimFrames Class Reference

AnimFrames manages the frames of an animated Sprite. More...

#include <SpriteEngine.h>

Collaboration diagram for AnimFrames:

Collaboration graph

[legend]
List of all members.

Public Types

enum  OptimizationMode {
  optNONE = 0,
  optBUFFER = 1,
  optNO_MASK = 2
}

Public Methods

 AnimFrames (UInt16 numFrames, DmResID bitmapID, DmResID maskID = -1, Coord hotSpotX = 0, Coord hotSpotY = 0, OptimizationMode optimizationMode = optNONE)
 Create an instance of AnimFrames. More...

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

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


Friends

class  Sprite

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 optimization.

Definition at line 45 of file SpriteEngine.h.


Member Enumeration Documentation

enum AnimFrames::OptimizationMode
 

Enumeration values:
optNONE   Do not optimize the frames.
optBUFFER   Draw the frames into an offscreen buffer for faster display.
optNO_MASK   Make the frames non-transparent. Do this whenever possible!

Definition at line 49 of file SpriteEngine.h.


Constructor & Destructor Documentation

AnimFrames::AnimFrames ( UInt16 numFrames,
DmResID bitmapID,
DmResID maskID = -1,
Coord hotSpotX = 0,
Coord hotSpotY = 0,
OptimizationMode optimizationMode = optNONE )
 

Create an instance of 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, or -1 when no masks are desired (optimizationMode == optNO_MASK).
hotSpotX   the horizontal offset of the hotspot.
hotSpotY   the vertical offset of the hotspot.
optimizationMode   which optimizations shall be applied?

Definition at line 31 of file SpriteEngine.cpp.

AnimFrames::~AnimFrames ( )
 

Destroy the AnimFrames and deallocate all used resources.

Definition at line 111 of file SpriteEngine.cpp.


Member Function Documentation

void 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.

Definition at line 130 of file SpriteEngine.cpp.

Referenced by Sprite::getBounds().


Friends And Related Function Documentation

class Sprite [friend]
 

Definition at line 140 of file SpriteEngine.h.


The documentation for this class was generated from the following files:
Razor! Engine Developer's Guide. Copyright © by Tilo Christ. All Rights Reserved. Last updated: 17 Dec 2000