The QCanvasSprite class provides an animated moving pixmap on a QCanvas. More...
#include <qcanvas.h>
Inherits QCanvasItem.
A "sprite" is an image object that moves around independently of foreground and background. On a QCanvas, everything moves around independently of the foreground and background, so a QCanvasSprite is just a image whose API makes it simpler to use animation and a hot spot.
QCanvasSprite draws very fast, at the cost of some memory.
Constructs a QCanvasSprite which uses images from the given array.
The sprite in initially at (0,0) on canvas, using frame 0.
[virtual]
Destruct the sprite. It is removed from its QCanvas in this process.
[protected]
The absolute horizontal position of the sprite. This is the pixel position of the left edge of the image, as it takes into account the offset.
[protected]
The absolute horizontal position of the sprite, if it was moved to nx.
[protected]
The right edge of the sprite image.
See also absX().
[protected]
The right edge of the sprite image, if the sprite was moved to nx.
See also absX().
[protected]
The absolute vertical position of the sprite. This is the pixel position of the top edge of the image, as it takes into account the offset.
[protected]
The absolute vertical position of the sprite, if it was moved to ny.
[protected]
The bottom edge of the sprite image.
See also absY().
[protected]
The bottom edge of the sprite image, if the sprite was moved to ny.
See also absY().
[virtual]
Returns the bounding rectangle of pixels covered by the sprite. This assumes that the images are tightly cropped (ie. do not have transparent pixels all along a side).
Reimplemented from QCanvasItem.
[virtual]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QCanvasItem.
[virtual protected]
Draws the current image of the sprite at its current position, as given by image() and x(), y().
Reimplemented from QCanvasItem.
Returns the index into the QCanvasSprite's QCanvasPixmapArray of the current animation frame.
See also setFrame() and move(double,double,int).
Returns the number of frames in the QCanvasSprite's QCanvasPixmapArray.
[protected]
The height of the sprite, in its current image.
See also frame().
[protected]
Returns the current image frame.
See also frame() and setFrame().
[protected]
Returns image frame f.
[virtual protected]
The image the sprite will have after advance(1) is called. Be default this is the same as image().
[virtual]
Set both the position and the frame of the sprite.
Reimplemented for internal reasons; the API is not affected.
[virtual]
Returns 1.
Sets the animation frame used for displaying the sprite to f, an index into the QCanvasSprite's QCanvasPixmapArray.
See also frame() and move(double,double,int).
Set the array of images used for displaying the sprite. Note that the array should have enough images for the sprites current frame() to be valid.
[protected]
The width of the sprite, in its current image.
See also frame().
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.
Copyright © 2000 Trolltech | Trademarks | Qt version 2.2.1
|