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.

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.

QwSpritePixmapQwSpritePixmapSequence::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 copyright © 1995-97 Warwick Allison.

It was generated from the following files:


Generated at 18:55, 1998/01/23 for Qt version 1.4 by the warwick at Troll Tech