QwPositionedSprite Class Reference


A QwVirtualSprite with a stored position and frame number. More...

#include <QwSpriteField.h>

Inherits QwVirtualSprite.

List of all member functions.

Public Members


Detailed Description

A QwVirtualSprite with a stored position and frame number.

This is a template class which allows any numerical class to be used as the stored coordinate type of a QwVirtualSprite. Two derived classes, QwSprite and QwRealSprite provide \t integer and \t double instantiations of this class.


Member Function Documentation

QwPositionedSprite::QwPositionedSprite ()

Create a QwPositionedSprite without defining its image sequence.

The sprite in initially at (0,0) on the current playfield (see constructor for QwSpriteField), using the 0th sequence frame.

Note that you must call setSequence(QwSpritePixmapSequence&) before doing anything else with the sprite.

QwPositionedSprite::QwPositionedSprite (QwSpritePixmapSequence& seq)

Create a QwPositionedSprite which uses images from the given sequence.

The sprite in initially at (0,0) on the current playfield (see constructor for QwSpriteField), using the 0th sequence frame.

QwPositionedSprite::~QwPositionedSprite () [virtual]

Destruct the sprite. It is removed from its QwSpriteField in this process.

COORD QwPositionedSprite::exact_x () const

Returns the X-position, in COORD units rather than the integer pixel coordinates used by the graphical engine.

COORD QwPositionedSprite::exact_y () const

Returns the Y-position, in COORD units rather than the integer pixel coordinates used by the graphical engine.

int QwPositionedSprite::frame () const

Returns the index into the QwPositionedSprite's QwSpritePixmapSequence of the current animation frame.

See also: moveTo(COORD,COORD,int).

void QwPositionedSprite::frame (int f)

Set the animation frame used for displaying the sprite to the given index into the QwPositionedSprite's QwSpritePixmapSequence.

See also: moveTo(COORD,COORD,int).

int QwPositionedSprite::frameCount () const

Returns the number of frames in the QwPositionedSprite's QwSpritePixmapSequence.

void QwPositionedSprite::moveBy (COORD dx, COORD dy)

Move the sprite from its current position by the given amounts.

void QwPositionedSprite::moveTo (COORD nx, COORD ny)

Move the sprite to the given absolute position.

See also: moveBy(COORD,COORD) and moveTo(COORD,COORD,int).

void QwPositionedSprite::moveTo (COORD nx, COORD ny, int nf) [virtual]

Set both the position and the frame of the sprite.

Pix QwPositionedSprite::neighbourhood (COORD nx, COORD ny, int nframe)

Similar to QwVirtualSprite::neighbourhood(int x, int y, QwSpritePixmap*), but the image is specified by index rather than actual value.

Pix QwPositionedSprite::neighbourhood (int nframe)

Similar to QwVirtualSprite::neighbourhood(int x, int y, QwSpritePixmap*), but the image is specified by index rather than actual value.

int QwPositionedSprite::rtti () const [virtual]

Returns 2.

See also: QwSpriteFieldGraphic::rtti().

void QwPositionedSprite::setSequence (QwSpritePixmapSequence& seq)

Set the sequence of images used for displaying the sprite. Note that the sequence should have enough images for the sprites current frame() to be valid.

bool QwPositionedSprite::wouldHit (QwSpriteFieldGraphic& other, COORD x, COORD y, int frame) const

Similar to QwVirtualSprite::wouldHit(QwSpriteFieldGraphic&, int x, int y, QwSpritePixmap*), but the image is specified by index rather than actual value.

int QwPositionedSprite::x () const [virtual]

Returns the stored horizontal position of the sprite.

void QwPositionedSprite::x (COORD nx)

Set the horizontal position of the sprite.

See also: moveTo(COORD,COORD).

int QwPositionedSprite::y () const [virtual]

Returns the stored vertical position of the sprite.

void QwPositionedSprite::y (COORD ny)

Set the vertical position of the sprite.

See also: moveTo(COORD,COORD).

int QwPositionedSprite::z () const [virtual]

Returns the stored z of the sprite.

void QwPositionedSprite::z (int a)

Sets the stored z of the sprite.


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