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

SpriteGroup Class Reference

Collaboration diagram for SpriteGroup:

Collaboration graph
[legend]
List of all members.

Detailed Description

SpriteGroup assists in the management of a collection of sprites.

Definition at line 294 of file SpriteEngine.h.

Public Member Functions

 SpriteGroup (UInt16 numSprites) SEC_RAZOR_INIT
 Create a SpriteGroup.

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

void createSprite (UInt16 spriteIdx, const AnimFrames *animFrames, Boolean visible=true, Boolean saveBackground=false) SEC_RAZOR_INIT
 Create an animated sprite with the specified AnimFrames.

void createSprites (const AnimFrames *animFrames, Boolean visible=true, Boolean saveBackground=false) SEC_RAZOR_INIT
 Create a group of identical animated sprites with the specified AnimFrames.

void draw (RectangleType *bounds=NULL) SEC_RAZOR
 Draw all the sprites in the group.

void restoreBackground () const SEC_RAZOR
 Restore the background of all sprites in the group.

State management (visibility, position, etc.)
void show (UInt16 spriteIdx)
 Show the sprite during subsequent draws.

void hide (UInt16 spriteIdx)
 Hide the sprite during subsequent draws.

Boolean setVisibility (UInt16 spriteIdx, Boolean visible)
 Set the visibility of the sprite through a flag.

Boolean isVisible (UInt16 spriteIdx) const
 Will the sprite be drawn during subsequent draws?

void setFrame (UInt16 spriteIdx, UInt16 frameIndex)
 Set the displayed frame of the Sprite.

void move (UInt16 spriteIdx, Coord x, Coord y)
 Move the sprite (i.e.


Constructor & Destructor Documentation

SpriteGroup::SpriteGroup UInt16    numSprites
 

Create a SpriteGroup.

Parameters:
numSprites the number of managed sprites

SpriteGroup::~SpriteGroup  
 

Destroy the SpriteGroup and deallocate all used resources.


Member Function Documentation

void SpriteGroup::createSprite UInt16    spriteIdx,
const AnimFrames   animFrames,
Boolean    visible = true,
Boolean    saveBackground = false
 

Create an animated sprite with the specified AnimFrames.

Ownership of the AnimFrames object is NOT transferred to the Sprite. It will not automatically be destroyed when the Sprite is destroyed.

Parameters:
animFrames a reference to an AnimFrames object
visible shall the sprite be visible?
saveBackground shall the sprite's background be preserved during a draw operation?

void SpriteGroup::createSprites const AnimFrames   animFrames,
Boolean    visible = true,
Boolean    saveBackground = false
 

Create a group of identical animated sprites with the specified AnimFrames.

All Sprites in the SpriteGroup will be set to the specified properties. Ownership of the AnimFrames object is NOT transferred to the Sprite. It will not automatically be destroyed when the Sprite is destroyed.

Parameters:
animFrames a reference to an AnimFrames object
visible shall the sprite be visible?
saveBackground shall the sprite's background be preserved during a draw operation?

void SpriteGroup::show UInt16    spriteIdx
 

Show the sprite during subsequent draws.

void SpriteGroup::hide UInt16    spriteIdx
 

Hide the sprite during subsequent draws.

Boolean SpriteGroup::setVisibility UInt16    spriteIdx,
Boolean    visible
 

Set the visibility of the sprite through a flag.

Parameters:
visible shall the sprite be visible (true = shown / false = hidden)

Boolean SpriteGroup::isVisible UInt16    spriteIdx const
 

Will the sprite be drawn during subsequent draws?

void SpriteGroup::setFrame UInt16    spriteIdx,
UInt16    frameIndex
 

Set the displayed frame of the Sprite.

Parameters:
frameIndex the index of the displayed frame. Must be between 0..numFrames-1 of the associated AnimFrames.

void SpriteGroup::move UInt16    spriteIdx,
Coord    x,
Coord    y
 

Move the sprite (i.e.

its hotspot) to the specified coordinates.

void SpriteGroup::draw RectangleType *    bounds = NULL
 

Draw all the sprites in the group.

void SpriteGroup::restoreBackground   const
 

Restore the background of all sprites in the group.


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