1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QCanvasSprite Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QCanvasSprite Class Reference<br><small>[ <a href="canvas.html">canvas module</a> ]</small></h1><br clear="all">
<p>
The QCanvasSprite class provides an animated moving pixmap on a <a href="qcanvas.html">QCanvas</a>.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qcanvas-h.html">qcanvas.h</a>></code>
<p>
Inherits <a href="qcanvasitem.html">QCanvasItem</a>.
<p><a href="qcanvassprite-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#4ffee1"><b>QCanvasSprite</b></a>(QCanvasPixmapArray*array, QCanvas*canvas)</div>
<li><div class="fn">void<a href="#d0ebbf"><b>setSequence</b></a>(QCanvasPixmapArray*seq)</div>
<li><div class="fn">virtual<a href="#419b5e"><b>~QCanvasSprite</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#b90f8d"><b>move</b></a>(doublex, doubley, intframe)</div>
<li><div class="fn">void<a href="#6428d6"><b>setFrame</b></a>(int)</div>
<li><div class="fn">int<a href="#5a45fd"><b>frame</b></a>()const</div>
<li><div class="fn">int<a href="#3601d2"><b>frameCount</b></a>()const</div>
<li><div class="fn">virtualint<a href="#8eb9cd"><b>rtti</b></a>()const</div>
<li><div class="fn">virtualQRect<a href="#107def"><b>boundingRect</b></a>()const</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">virtualvoid<a href="#ae5194"><b>draw</b></a>(QPainter&painter)</div>
<li><div class="fn">int<a href="#e9c1be"><b>width</b></a>()const</div>
<li><div class="fn">int<a href="#351c2c"><b>height</b></a>()const</div>
<li><div class="fn">int<a href="#510e4b"><b>absX</b></a>()const</div>
<li><div class="fn">int<a href="#a29b91"><b>absY</b></a>()const</div>
<li><div class="fn">int<a href="#62d8f8"><b>absX2</b></a>()const</div>
<li><div class="fn">int<a href="#ef4c32"><b>absY2</b></a>()const</div>
<li><div class="fn">int<a href="#ea41ce"><b>absX</b></a>(intnx)const</div>
<li><div class="fn">int<a href="#2bc7cd"><b>absY</b></a>(intny)const</div>
<li><div class="fn">int<a href="#6b13e9"><b>absX2</b></a>(intnx)const</div>
<li><div class="fn">int<a href="#064ef2"><b>absY2</b></a>(intny)const</div>
<li><div class="fn">QCanvasPixmap*<a href="#150d57"><b>image</b></a>()const</div>
<li><div class="fn">virtualQCanvasPixmap*<a href="#75099b"><b>imageAdvanced</b></a>()const</div>
<li><div class="fn">QCanvasPixmap*<a href="#35edbe"><b>image</b></a>(intf)const</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QCanvasSprite class provides an animated moving pixmap on a <a href="qcanvas.html">QCanvas</a>.
<p>
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.
<p>QCanvasSprite draws very fast, at the cost of some memory.
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="4ffee1"></a>QCanvasSprite::QCanvasSprite(<a href="qcanvaspixmaparray.html">QCanvasPixmapArray</a>*a, <a href="qcanvas.html">QCanvas</a>*canvas)</h3>
<p>Constructs a QCanvasSprite which uses images from the given array.
<p>The sprite in initially at (0,0) on <em>canvas,</em> using frame 0.
<h3 class="fn"><a name="419b5e"></a>QCanvasSprite::~QCanvasSprite() <code>[virtual]</code></h3>
<p>Destruct the sprite.
It is removed from its <a href="qcanvas.html">QCanvas</a> in this process.
<h3 class="fn">int<a name="510e4b"></a>QCanvasSprite::absX()const <code>[protected]</code></h3>
<p>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.
<h3 class="fn">int<a name="ea41ce"></a>QCanvasSprite::absX(intnx)const <code>[protected]</code></h3>
<p>The absolute horizontal position of the sprite, if it was moved to
<em>nx.</em>
<h3 class="fn">int<a name="62d8f8"></a>QCanvasSprite::absX2()const <code>[protected]</code></h3>
<p>The right edge of the sprite image.
<p>See also <a href="#510e4b">absX</a>().
<h3 class="fn">int<a name="6b13e9"></a>QCanvasSprite::absX2(intnx)const <code>[protected]</code></h3>
<p>The right edge of the sprite image, if the sprite was moved to <em>nx.</em>
<p>See also <a href="#510e4b">absX</a>().
<h3 class="fn">int<a name="a29b91"></a>QCanvasSprite::absY()const <code>[protected]</code></h3>
<p>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.
<h3 class="fn">int<a name="2bc7cd"></a>QCanvasSprite::absY(intny)const <code>[protected]</code></h3>
<p>The absolute vertical position of the sprite, if it was
moved to <em>ny.</em>
<h3 class="fn">int<a name="ef4c32"></a>QCanvasSprite::absY2()const <code>[protected]</code></h3>
<p>The bottom edge of the sprite image.
<p>See also <a href="#2bc7cd">absY</a>().
<h3 class="fn">int<a name="064ef2"></a>QCanvasSprite::absY2(intny)const <code>[protected]</code></h3>
<p>The bottom edge of the sprite image, <em>if</em> the sprite was moved to <em>ny.</em>
<p>See also <a href="#2bc7cd">absY</a>().
<h3 class="fn"><a href="qrect.html">QRect</a><a name="107def"></a>QCanvasSprite::boundingRect()const <code>[virtual]</code></h3>
<p>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).
<p>Reimplemented from <a href="qcanvasitem.html#156958">QCanvasItem.</a>
<h3 class="fn">bool<a name="6e05e0"></a>QCanvasSprite::collidesWith(const<a href="qcanvasitem.html">QCanvasItem</a>*i)const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qcanvasitem.html#1d22d3">QCanvasItem.</a>
<h3 class="fn">void<a name="ae5194"></a>QCanvasSprite::draw(<a href="qpainter.html">QPainter</a>&painter) <code>[virtualprotected]</code></h3>
<p>Draws the current image of the sprite at its current position,
as given by <a href="#150d57">image</a>() and <a href="qcanvasitem.html#e0e6af">x</a>(), <a href="qcanvasitem.html#2eabbd">y</a>().
<p>Reimplemented from <a href="qcanvasitem.html#cce3d0">QCanvasItem.</a>
<h3 class="fn">int<a name="5a45fd"></a>QCanvasSprite::frame()const</h3>
<p>Returns the index into the QCanvasSprite's <a href="qcanvaspixmaparray.html">QCanvasPixmapArray</a>
of the current animation frame.
<p>See also <a href="#6428d6">setFrame</a>() and <a href="#b90f8d">move</a>(double,double,int).
<h3 class="fn">int<a name="3601d2"></a>QCanvasSprite::frameCount()const</h3>
<p>Returns the number of frames in the QCanvasSprite's <a href="qcanvaspixmaparray.html">QCanvasPixmapArray</a>.
<h3 class="fn">int<a name="351c2c"></a>QCanvasSprite::height()const <code>[protected]</code></h3>
<p>The height of the sprite, in its current image.
<p>See also <a href="#5a45fd">frame</a>().
<h3 class="fn"><a href="qcanvaspixmap.html">QCanvasPixmap</a>*<a name="150d57"></a>QCanvasSprite::image()const <code>[protected]</code></h3>
<p>Returns the current image frame.
<p>See also <a href="#5a45fd">frame</a>() and <a href="#6428d6">setFrame</a>().
<h3 class="fn"><a href="qcanvaspixmap.html">QCanvasPixmap</a>*<a name="35edbe"></a>QCanvasSprite::image(intf)const <code>[protected]</code></h3>
<p>Returns image frame <em>f.</em>
<h3 class="fn"><a href="qcanvaspixmap.html">QCanvasPixmap</a>*<a name="75099b"></a>QCanvasSprite::imageAdvanced()const <code>[virtualprotected]</code></h3>
<p>The image the sprite <em>will</em> have after <a href="qcanvasitem.html#3bf03d">advance</a>(1) is called.
Be default this is the same as <a href="#150d57">image</a>().
<h3 class="fn">void<a name="b90f8d"></a>QCanvasSprite::move(doublenx, doubleny, intnf) <code>[virtual]</code></h3>
<p>Set both the position and the frame of the sprite.
<h3 class="fn">void<a name="d9c6f2"></a>QCanvasSprite::move(doublex, doubley)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">int<a name="8eb9cd"></a>QCanvasSprite::rtti()const <code>[virtual]</code></h3>
<p>Returns 1.
<h3 class="fn">void<a name="6428d6"></a>QCanvasSprite::setFrame(intf)</h3>
<p>Sets the animation frame used for displaying the sprite to
<em>f,</em> an index into the QCanvasSprite's <a href="qcanvaspixmaparray.html">QCanvasPixmapArray</a>.
<p>See also <a href="#5a45fd">frame</a>() and <a href="#b90f8d">move</a>(double,double,int).
<h3 class="fn">void<a name="d0ebbf"></a>QCanvasSprite::setSequence(<a href="qcanvaspixmaparray.html">QCanvasPixmapArray</a>*a)</h3>
<p>Set the array of images used for displaying the sprite. Note that
the array should have enough images for the sprites current <a href="#5a45fd">frame</a>()
to be valid.
<h3 class="fn">int<a name="e9c1be"></a>QCanvasSprite::width()const <code>[protected]</code></h3>
<p>The width of the sprite, in its current image.
<p>See also <a href="#5a45fd">frame</a>().
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|