QwSpritePixmapSequence Class Reference


A sequence of QwSpritePixmap to have multiple frames for animation. More...

#include <QwSpriteField.h>

List of all member functions.

Public Members


Detailed Description

A sequence of QwSpritePixmap to have multiple frames for animation.

A sequence of QwSpritePixmap, for use in allowing sprite objects to have multiple frames for animation.

QwSpritePixmaps for sprite objects are collected into QwSpritePixmapSequences, which are the set of images a sprite will use, indexed by the sprite's frame. This allows sprites to simply have animated forms.


Member Function Documentation

QwSpritePixmapSequence::QwSpritePixmapSequence (const char* datafilenamepattern, const char* maskfilenamepattern, int fc=1)

Construct a QwSpritePixmapSequence

The framecount parameter sets the number of frames to be loaded for this image. The filenames should be printf-style strings such as "foo%03d.ppm" or "animdir/%4d.pbm". The actual filenames are formed by sprintf-ing a string with each integer from 0 to framecount-1, eg. foo000.ppm, foo001.ppm, foo002.ppm, etc.

int QwSpritePixmapSequence::frameCount () const

Returns the length of the sequence.

QwSpritePixmap* QwSpritePixmapSequence::image (int i) const

Returns the i-th pixmap in the sequence.

int QwSpritePixmapSequence::operator! ()

Constructor failure check. Currently not implemented. Exceptions would be a better solution.

void QwSpritePixmapSequence::readCollisionMasks (const char* fname)

When testing sprite collision detection with QwSpriteField::exact(Pix), the default is to use the image mask of the sprite. By using readCollisionMasks(const char*), an alternate mask can be used. Also, by using QwVirtualSprite::setPixelCollisionPrecision(int), the resolution of the collision mask can be different to the resolution of the pixel coordinates of the sprites.

The filename is a printf-style string, as per the constructor for QwSpritePixmapSequence.

The image must be a PBM file, with a HOTSPOT comment as described in QwSpritePixmap::QwSpritePixmap(const char*, const char*).

See also: QwVirtualSprite::setPixelCollisionPrecision(int).


This file is part of a class set, copyright © 1995-96 Warwick Allison

It was generated from the following files:


Generated at 15:00, 1996/10/21