# QwSpritePixmapSequence Class Reference

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

`#include <QwSpriteField.h>`

List of all member functions.

## Public Members

- QwSpritePixmapSequence ( const char * datafilenamepattern, const char * maskfilenamepattern, int framecount=1 )
- QwSpritePixmapSequence ( QList<QPixmap>, QList<QPoint> hotspots )
- ~QwSpritePixmapSequence ()
- void readCollisionMasks ( const char * filenamepattern )
- int operator! ()
- QwSpritePixmap* image ( int i ) const
- void setImage ( int i, QwSpritePixmap * p )
- int frameCount () const

## Detailed Description

A sequence of QwSpritePixmap to have multiple frames for animation.

This allows 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 ( QList<QPixmap> list, QList<QPoint> hotspots )

Construct a QwSpritePixmapSequence from QPixmaps.

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

Construct a QwSpritePixmapSequence from files.

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.

### QwSpritePixmapSequence::~QwSpritePixmapSequence ()

Destructs the pixmap sequence.

### 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).

### void QwSpritePixmapSequence::setImage ( int i, QwSpritePixmap * p )

Deletes the i-th pixmap and replaces it by p. Note that p becomes owned by the sequence - it will be deleted later.

This file is copyright © 1995-97 Warwick Allison.

It was generated from the following files:

- QwSpriteField.h
- QwSpriteField-double.cpp
- QwSpriteField-int.cpp
- QwSpriteField-mobdouble.cpp
- QwSpriteField-mobint.cpp
- QwSpriteField-template.cpp
- QwSpriteField.cpp