QwPolygonalGraphic Class Reference


NOT YET IMPLEMENTED - A QwSpriteFieldGraphic which renders itself in a polygonal area. More...

#include <QwSpriteField.h>

Inherits QwSpriteFieldGraphic.

List of all member functions.

Public Members

Protected Members


Detailed Description

NOT YET IMPLEMENTED - A QwSpriteFieldGraphic which renders itself in a polygonal area.

QwPolygonalGraphic is an abstract class that is useful for all graphics which cover a polygonal area of chunks on the field. Sprites, the other branch of QwSpriteFieldGraphic derivatives usually cover a simple rectangular area and are dealt with specially, but typical geometric shapes such as lines and circles would be quite inefficiently bounded by rectangular areas - a diagonal line from one corner of the field area to the other bound be bounded by a rectangle covering the entire area! QwPolygonalGraphic objects allow the area to be defined by a polygon - a sequence of points indicating the chunks bounding the area covered by the graphic.

Derived classes should try to define as small as possible an area to maximize efficiency, but must definately be contained completely within the polygonal area. Calculating the exact requirements will generally be difficult, and hence a certain amount of over-estimation could be expected.

See also: QwLineGraphic? and QwCircleGraphic?.


Member Function Documentation

QwPolygonalGraphic::QwPolygonalGraphic ()

Construct a QwPolygonalGraphic. Derived classes should call addToChunks() in their constructor once numAreaPoints() and getAreaPoints() are valid.

NOT YET IMPLEMENTED.

QwPolygonalGraphic::~QwPolygonalGraphic () [virtual]

Destruct the QwPolygonalGraphic. Derived classes must remove the area from any chunks, as this destructor cannot call the virtual methods required to do so. That is, they must call removeFromChunks() in their destructor.

void QwPolygonalGraphic::addToChunks () [protected]

Add the area to the chunks in its QwSpriteField which it overlaps.

This must be called as the values of numAreaPoints() or getAreaPoints() change such that the QwPolygonalGraphic is removed from chunks it is in, the values change, then it is added back into the then covered chunks in the QwSpriteField.

void QwPolygonalGraphic::getAreaPoints ( QPoint pt[] ) const [virtual]

Should return the points of the polygonal area covered by the graphic. pt will be an array of the size given by numAreaPoints().

void QwPolygonalGraphic::makeVisible ( bool yes ) [virtual protected]

Adds/removes the area from the QwSpriteField chunks it covers, as required by QwSpriteFieldGraphic. This, addToChunks, and the removeFromChunks method may be moved up to QwSpriteFieldGraphic. Either way, this or the other two would have to be virtual.

int QwPolygonalGraphic::numAreaPoints () const [virtual]

Should return the number of points of the polygonal area covered by the graphic.

void QwPolygonalGraphic::removeFromChunks () [protected]

Remove the area from the chunks in its QwSpriteField which it overlaps.

See also: addToChunks().

int QwPolygonalGraphic::rtti () const [virtual]

Returns 2.

See also: QwSpriteFieldGraphic::rtti().


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