summaryrefslogtreecommitdiff
path: root/doc/html/Sprite_8cpp-source.htm
blob: a4e240522ab39c2646cd884125bcb59c513cf975 (plain)
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>SFML - Simple and Fast Multimedia Library</title>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="tabs.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div id="logo">
            <img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" />
        </div>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.htm"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.htm"><span>Namespaces</span></a></li>
      <li><a href="annotated.htm"><span>Classes</span></a></li>
      <li class="current"><a href="files.htm"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.htm"><span>File&nbsp;List</span></a></li>
    </ul>
  </div>
<h1>Sprite.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// SFML - Simple and Fast Multimedia Library</span>
<a name="l00004"></a>00004 <span class="comment">// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)</span>
<a name="l00005"></a>00005 <span class="comment">//</span>
<a name="l00006"></a>00006 <span class="comment">// This software is provided 'as-is', without any express or implied warranty.</span>
<a name="l00007"></a>00007 <span class="comment">// In no event will the authors be held liable for any damages arising from the use of this software.</span>
<a name="l00008"></a>00008 <span class="comment">//</span>
<a name="l00009"></a>00009 <span class="comment">// Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00010"></a>00010 <span class="comment">// including commercial applications, and to alter it and redistribute it freely,</span>
<a name="l00011"></a>00011 <span class="comment">// subject to the following restrictions:</span>
<a name="l00012"></a>00012 <span class="comment">//</span>
<a name="l00013"></a>00013 <span class="comment">// 1. The origin of this software must not be misrepresented;</span>
<a name="l00014"></a>00014 <span class="comment">//    you must not claim that you wrote the original software.</span>
<a name="l00015"></a>00015 <span class="comment">//    If you use this software in a product, an acknowledgment</span>
<a name="l00016"></a>00016 <span class="comment">//    in the product documentation would be appreciated but is not required.</span>
<a name="l00017"></a>00017 <span class="comment">//</span>
<a name="l00018"></a>00018 <span class="comment">// 2. Altered source versions must be plainly marked as such,</span>
<a name="l00019"></a>00019 <span class="comment">//    and must not be misrepresented as being the original software.</span>
<a name="l00020"></a>00020 <span class="comment">//</span>
<a name="l00021"></a>00021 <span class="comment">// 3. This notice may not be removed or altered from any source distribution.</span>
<a name="l00022"></a>00022 <span class="comment">//</span>
<a name="l00024"></a>00024 <span class="comment"></span>
<a name="l00026"></a>00026 <span class="comment">// Headers</span>
<a name="l00028"></a>00028 <span class="comment"></span><span class="preprocessor">#include &lt;SFML/Graphics/Sprite.hpp&gt;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;SFML/Graphics/Image.hpp&gt;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;SFML/Graphics/GraphicsContext.hpp&gt;</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="keyword">namespace </span>sf
<a name="l00034"></a>00034 {
<a name="l00038"></a><a class="code" href="classsf_1_1Sprite.htm#92559fbca895a96758abf5eabab96984">00038</a> <a class="code" href="classsf_1_1Sprite.htm#92559fbca895a96758abf5eabab96984" title="Default constructor.">Sprite::Sprite</a>() :
<a name="l00039"></a>00039 mySubRect   (0, 0, 1, 1),
<a name="l00040"></a>00040 myIsFlippedX(false),
<a name="l00041"></a>00041 myIsFlippedY(false)
<a name="l00042"></a>00042 {
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 }
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 
<a name="l00050"></a><a class="code" href="classsf_1_1Sprite.htm#6992dc47da2f9349bbe691db532f2436">00050</a> <a class="code" href="classsf_1_1Sprite.htm#92559fbca895a96758abf5eabab96984" title="Default constructor.">Sprite::Sprite</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>&amp; Img, <span class="keyword">const</span> <a class="code" href="classsf_1_1Vector2.htm">Vector2f</a>&amp; Position, <span class="keyword">const</span> <a class="code" href="classsf_1_1Vector2.htm">Vector2f</a>&amp; Scale, <span class="keywordtype">float</span> Rotation, <span class="keyword">const</span> <a class="code" href="classsf_1_1Color.htm" title="Color is an utility class for manipulating 32-bits RGBA colors.">Color</a>&amp; Col) :
<a name="l00051"></a>00051 <a class="code" href="classsf_1_1Drawable.htm" title="Abstract base class for every object that can be drawn into a render window.">Drawable</a>    (Position, Scale, Rotation, Col),
<a name="l00052"></a>00052 mySubRect   (0, 0, 1, 1),
<a name="l00053"></a>00053 myIsFlippedX(false),
<a name="l00054"></a>00054 myIsFlippedY(false)
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056     <a class="code" href="classsf_1_1Sprite.htm#3674c4c0556e4e19cb307d52f254b53c" title="Change the image of the sprite.">SetImage</a>(Img);
<a name="l00057"></a>00057 }
<a name="l00058"></a>00058 
<a name="l00059"></a>00059 
<a name="l00063"></a><a class="code" href="classsf_1_1Sprite.htm#3674c4c0556e4e19cb307d52f254b53c">00063</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Sprite.htm#3674c4c0556e4e19cb307d52f254b53c" title="Change the image of the sprite.">Sprite::SetImage</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>&amp; Img)
<a name="l00064"></a>00064 {
<a name="l00065"></a>00065     <span class="comment">// If there was no source image before and the new image is valid, adjust the source rectangle</span>
<a name="l00066"></a>00066     <span class="keywordflow">if</span> (!myImage &amp;&amp; (Img.<a class="code" href="classsf_1_1Image.htm#896f09a4eb769b5b866b6dde9c1a25e7" title="Return the width of the image.">GetWidth</a>() &gt; 0) &amp;&amp; (Img.<a class="code" href="classsf_1_1Image.htm#f2131512b6290fd96fd10c539723fe89" title="Return the height of the image.">GetHeight</a>() &gt; 0))
<a name="l00067"></a>00067     {
<a name="l00068"></a>00068         <a class="code" href="classsf_1_1Sprite.htm#54bf1e6b425c40b00dd544a9c4fb77df" title="Set the sub-rectangle of the sprite inside the source image.">SetSubRect</a>(<a class="code" href="classsf_1_1Rect.htm">IntRect</a>(0, 0, Img.<a class="code" href="classsf_1_1Image.htm#896f09a4eb769b5b866b6dde9c1a25e7" title="Return the width of the image.">GetWidth</a>(), Img.<a class="code" href="classsf_1_1Image.htm#f2131512b6290fd96fd10c539723fe89" title="Return the height of the image.">GetHeight</a>()));
<a name="l00069"></a>00069     }
<a name="l00070"></a>00070 
<a name="l00071"></a>00071     <span class="comment">// Assign the new image</span>
<a name="l00072"></a>00072     myImage = &amp;Img;
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 
<a name="l00079"></a><a class="code" href="classsf_1_1Sprite.htm#54bf1e6b425c40b00dd544a9c4fb77df">00079</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Sprite.htm#54bf1e6b425c40b00dd544a9c4fb77df" title="Set the sub-rectangle of the sprite inside the source image.">Sprite::SetSubRect</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1Rect.htm">IntRect</a>&amp; SubRect)
<a name="l00080"></a>00080 {
<a name="l00081"></a>00081     mySubRect = SubRect;
<a name="l00082"></a>00082 }
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 
<a name="l00089"></a><a class="code" href="classsf_1_1Sprite.htm#44a5075036963d312f3463caa2444e32">00089</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Sprite.htm#44a5075036963d312f3463caa2444e32" title="Resize the sprite (by changing its scale factors) (take 2 values).">Sprite::Resize</a>(<span class="keywordtype">float</span> Width, <span class="keywordtype">float</span> Height)
<a name="l00090"></a>00090 {
<a name="l00091"></a>00091     <span class="keywordtype">int</span> LocalWidth  = mySubRect.<a class="code" href="classsf_1_1Rect.htm#6a8c09ef44123228aa44aff8f0b09087" title="Get the width of the rectangle.">GetWidth</a>();
<a name="l00092"></a>00092     <span class="keywordtype">int</span> LocalHeight = mySubRect.<a class="code" href="classsf_1_1Rect.htm#a3c1ca9c959dae33d2eec290b2e48d75" title="Get the height of the rectangle.">GetHeight</a>();
<a name="l00093"></a>00093 
<a name="l00094"></a>00094     <span class="keywordflow">if</span> ((LocalWidth &gt; 0) &amp;&amp; (LocalHeight &gt; 0))
<a name="l00095"></a>00095         <a class="code" href="classsf_1_1Drawable.htm#0b486c56c2bd137bac629f72fea66769" title="Set the scale of the object (take 2 values).">SetScale</a>(Width / LocalWidth, Height / LocalHeight);
<a name="l00096"></a>00096 }
<a name="l00097"></a>00097 
<a name="l00098"></a>00098 
<a name="l00103"></a><a class="code" href="classsf_1_1Sprite.htm#7cc9df731a61f91ecd16b4a84de499aa">00103</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Sprite.htm#44a5075036963d312f3463caa2444e32" title="Resize the sprite (by changing its scale factors) (take 2 values).">Sprite::Resize</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1Vector2.htm">Vector2f</a>&amp; Size)
<a name="l00104"></a>00104 {
<a name="l00105"></a>00105     <a class="code" href="classsf_1_1Sprite.htm#44a5075036963d312f3463caa2444e32" title="Resize the sprite (by changing its scale factors) (take 2 values).">Resize</a>(Size.<a class="code" href="classsf_1_1Vector2.htm#1e6ad77fa155f3753bfb92699bd28141" title="X coordinate of the vector.">x</a>, Size.<a class="code" href="classsf_1_1Vector2.htm#420f2481b015f4eb929c75f2af564299" title="Y coordinate of the vector.">y</a>);
<a name="l00106"></a>00106 }
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 
<a name="l00112"></a><a class="code" href="classsf_1_1Sprite.htm#262e7dfd12caa5c434d546b68e5ff71b">00112</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Sprite.htm#262e7dfd12caa5c434d546b68e5ff71b" title="Flip the sprite horizontally.">Sprite::FlipX</a>(<span class="keywordtype">bool</span> Flipped)
<a name="l00113"></a>00113 {
<a name="l00114"></a>00114     myIsFlippedX = Flipped;
<a name="l00115"></a>00115 }
<a name="l00116"></a>00116 
<a name="l00117"></a>00117 
<a name="l00121"></a><a class="code" href="classsf_1_1Sprite.htm#88e999eade1c55aadd5f618f1f17ec97">00121</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Sprite.htm#88e999eade1c55aadd5f618f1f17ec97" title="Flip the sprite vertically.">Sprite::FlipY</a>(<span class="keywordtype">bool</span> Flipped)
<a name="l00122"></a>00122 {
<a name="l00123"></a>00123     myIsFlippedY = Flipped;
<a name="l00124"></a>00124 }
<a name="l00125"></a>00125 
<a name="l00126"></a>00126 
<a name="l00130"></a><a class="code" href="classsf_1_1Sprite.htm#e2b23a9536486aa7ea3abc5801984aca">00130</a> <span class="keyword">const</span> <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>* <a class="code" href="classsf_1_1Sprite.htm#e2b23a9536486aa7ea3abc5801984aca" title="Get the source image of the sprite.">Sprite::GetImage</a>()<span class="keyword"> const</span>
<a name="l00131"></a>00131 <span class="keyword"></span>{
<a name="l00132"></a>00132     <span class="keywordflow">return</span> myImage;
<a name="l00133"></a>00133 }
<a name="l00134"></a>00134 
<a name="l00135"></a>00135 
<a name="l00139"></a><a class="code" href="classsf_1_1Sprite.htm#524cc0591bd56e48d8f0e0e5f9c9e941">00139</a> <span class="keyword">const</span> <a class="code" href="classsf_1_1Rect.htm">IntRect</a>&amp; <a class="code" href="classsf_1_1Sprite.htm#524cc0591bd56e48d8f0e0e5f9c9e941" title="Get the sub-rectangle of the sprite inside the source image.">Sprite::GetSubRect</a>()<span class="keyword"> const</span>
<a name="l00140"></a>00140 <span class="keyword"></span>{
<a name="l00141"></a>00141     <span class="keywordflow">return</span> mySubRect;
<a name="l00142"></a>00142 }
<a name="l00143"></a>00143 
<a name="l00144"></a>00144 
<a name="l00148"></a><a class="code" href="classsf_1_1Sprite.htm#386e09c5f321a69707393851ae026f7e">00148</a> <a class="code" href="classsf_1_1Vector2.htm">Vector2f</a> <a class="code" href="classsf_1_1Sprite.htm#386e09c5f321a69707393851ae026f7e" title="Get the sprite size.">Sprite::GetSize</a>()<span class="keyword"> const</span>
<a name="l00149"></a>00149 <span class="keyword"></span>{
<a name="l00150"></a>00150     <span class="keywordflow">return</span> <a class="code" href="classsf_1_1Vector2.htm">Vector2f</a>(mySubRect.<a class="code" href="classsf_1_1Rect.htm#6a8c09ef44123228aa44aff8f0b09087" title="Get the width of the rectangle.">GetWidth</a>() * <a class="code" href="classsf_1_1Drawable.htm#fa4d6b97e7c10a82430ff9ee56009c97" title="Get the current scale of the object.">GetScale</a>().<a class="code" href="classsf_1_1Vector2.htm#1e6ad77fa155f3753bfb92699bd28141" title="X coordinate of the vector.">x</a>, mySubRect.<a class="code" href="classsf_1_1Rect.htm#a3c1ca9c959dae33d2eec290b2e48d75" title="Get the height of the rectangle.">GetHeight</a>() * <a class="code" href="classsf_1_1Drawable.htm#fa4d6b97e7c10a82430ff9ee56009c97" title="Get the current scale of the object.">GetScale</a>().<a class="code" href="classsf_1_1Vector2.htm#420f2481b015f4eb929c75f2af564299" title="Y coordinate of the vector.">y</a>);
<a name="l00151"></a>00151 }
<a name="l00152"></a>00152 
<a name="l00153"></a>00153 
<a name="l00158"></a><a class="code" href="classsf_1_1Sprite.htm#5a54b2a7c2fd5464a499ea8ac7348c1c">00158</a> <a class="code" href="classsf_1_1Color.htm" title="Color is an utility class for manipulating 32-bits RGBA colors.">Color</a> <a class="code" href="classsf_1_1Sprite.htm#5a54b2a7c2fd5464a499ea8ac7348c1c" title="Get the color of a given pixel in the sprite (point is in local coordinates).">Sprite::GetPixel</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> X, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Y)<span class="keyword"> const</span>
<a name="l00159"></a>00159 <span class="keyword"></span>{
<a name="l00160"></a>00160     <span class="keywordflow">if</span> (myImage)
<a name="l00161"></a>00161     {
<a name="l00162"></a>00162         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ImageX = mySubRect.<a class="code" href="classsf_1_1Rect.htm#9619c6b9741163c86eea6a0b84b2f9b3" title="Left coordinate of the rectangle.">Left</a> + X;
<a name="l00163"></a>00163         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ImageY = mySubRect.<a class="code" href="classsf_1_1Rect.htm#4addcc0bf656fb5f2f80d406cf90c047" title="Top coordinate of the rectangle.">Top</a>  + Y;
<a name="l00164"></a>00164 
<a name="l00165"></a>00165         <span class="keywordflow">if</span> (myIsFlippedX) ImageX = mySubRect.<a class="code" href="classsf_1_1Rect.htm#6a8c09ef44123228aa44aff8f0b09087" title="Get the width of the rectangle.">GetWidth</a>()  - ImageX - 1;
<a name="l00166"></a>00166         <span class="keywordflow">if</span> (myIsFlippedY) ImageY = mySubRect.<a class="code" href="classsf_1_1Rect.htm#a3c1ca9c959dae33d2eec290b2e48d75" title="Get the height of the rectangle.">GetHeight</a>() - ImageY - 1;
<a name="l00167"></a>00167 
<a name="l00168"></a>00168         <span class="keywordflow">return</span> myImage-&gt;GetPixel(ImageX, ImageY) * <a class="code" href="classsf_1_1Drawable.htm#a2a028c4a975b5ed6d5a560a1c44e0c8" title="Get the color of the object.">GetColor</a>();
<a name="l00169"></a>00169     }
<a name="l00170"></a>00170     <span class="keywordflow">else</span>
<a name="l00171"></a>00171     {
<a name="l00172"></a>00172         <span class="keywordflow">return</span> <a class="code" href="classsf_1_1Drawable.htm#a2a028c4a975b5ed6d5a560a1c44e0c8" title="Get the color of the object.">GetColor</a>();
<a name="l00173"></a>00173     }
<a name="l00174"></a>00174 }
<a name="l00175"></a>00175 
<a name="l00176"></a>00176 
<a name="l00180"></a><a class="code" href="classsf_1_1Sprite.htm#0f52de16559efc4bf748a14f43318c7b">00180</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Sprite.htm#0f52de16559efc4bf748a14f43318c7b" title="/see Drawable::Render">Sprite::Render</a>(<a class="code" href="classsf_1_1RenderTarget.htm" title="Base class for all render targets (window, image, .">RenderTarget</a>&amp;)<span class="keyword"> const</span>
<a name="l00181"></a>00181 <span class="keyword"></span>{
<a name="l00182"></a>00182     <span class="comment">// Get the sprite size</span>
<a name="l00183"></a>00183     <span class="keywordtype">float</span> Width  = <span class="keyword">static_cast&lt;</span><span class="keywordtype">float</span><span class="keyword">&gt;</span>(mySubRect.<a class="code" href="classsf_1_1Rect.htm#6a8c09ef44123228aa44aff8f0b09087" title="Get the width of the rectangle.">GetWidth</a>());
<a name="l00184"></a>00184     <span class="keywordtype">float</span> Height = <span class="keyword">static_cast&lt;</span><span class="keywordtype">float</span><span class="keyword">&gt;</span>(mySubRect.<a class="code" href="classsf_1_1Rect.htm#a3c1ca9c959dae33d2eec290b2e48d75" title="Get the height of the rectangle.">GetHeight</a>());
<a name="l00185"></a>00185 
<a name="l00186"></a>00186     <span class="comment">// Check if the image is valid</span>
<a name="l00187"></a>00187     <span class="keywordflow">if</span> (myImage &amp;&amp; (myImage-&gt;GetWidth() &gt; 0) &amp;&amp; (myImage-&gt;GetHeight() &gt; 0))
<a name="l00188"></a>00188     {
<a name="l00189"></a>00189         <span class="comment">// Bind the texture</span>
<a name="l00190"></a>00190         myImage-&gt;Bind();
<a name="l00191"></a>00191 
<a name="l00192"></a>00192         <span class="comment">// Calculate the texture coordinates</span>
<a name="l00193"></a>00193         <a class="code" href="classsf_1_1Rect.htm">FloatRect</a> TexCoords = myImage-&gt;GetTexCoords(mySubRect);
<a name="l00194"></a>00194         <a class="code" href="classsf_1_1Rect.htm">FloatRect</a> <a class="code" href="classsf_1_1Rect.htm" title="Rect is an utility class for manipulating rectangles.">Rect</a>(myIsFlippedX ? TexCoords.<a class="code" href="classsf_1_1Rect.htm#6ce87895496327187a20a46dc2479383" title="Right coordinate of the rectangle.">Right</a>  : TexCoords.<a class="code" href="classsf_1_1Rect.htm#9619c6b9741163c86eea6a0b84b2f9b3" title="Left coordinate of the rectangle.">Left</a>,
<a name="l00195"></a>00195                        myIsFlippedY ? TexCoords.<a class="code" href="classsf_1_1Rect.htm#b234b311011892cfd8a3e831dec341a8" title="Bottom coordinate of the rectangle.">Bottom</a> : TexCoords.<a class="code" href="classsf_1_1Rect.htm#4addcc0bf656fb5f2f80d406cf90c047" title="Top coordinate of the rectangle.">Top</a>,
<a name="l00196"></a>00196                        myIsFlippedX ? TexCoords.<a class="code" href="classsf_1_1Rect.htm#9619c6b9741163c86eea6a0b84b2f9b3" title="Left coordinate of the rectangle.">Left</a>   : TexCoords.<a class="code" href="classsf_1_1Rect.htm#6ce87895496327187a20a46dc2479383" title="Right coordinate of the rectangle.">Right</a>,
<a name="l00197"></a>00197                        myIsFlippedY ? TexCoords.<a class="code" href="classsf_1_1Rect.htm#4addcc0bf656fb5f2f80d406cf90c047" title="Top coordinate of the rectangle.">Top</a>    : TexCoords.<a class="code" href="classsf_1_1Rect.htm#b234b311011892cfd8a3e831dec341a8" title="Bottom coordinate of the rectangle.">Bottom</a>);
<a name="l00198"></a>00198 
<a name="l00199"></a>00199         <span class="comment">// Draw the sprite's triangles</span>
<a name="l00200"></a>00200         glBegin(GL_QUADS);
<a name="l00201"></a>00201             glTexCoord2f(Rect.<a class="code" href="classsf_1_1Rect.htm#9619c6b9741163c86eea6a0b84b2f9b3" title="Left coordinate of the rectangle.">Left</a>,  Rect.<a class="code" href="classsf_1_1Rect.htm#4addcc0bf656fb5f2f80d406cf90c047" title="Top coordinate of the rectangle.">Top</a>);    glVertex2f(0,     0);
<a name="l00202"></a>00202             glTexCoord2f(Rect.<a class="code" href="classsf_1_1Rect.htm#9619c6b9741163c86eea6a0b84b2f9b3" title="Left coordinate of the rectangle.">Left</a>,  Rect.<a class="code" href="classsf_1_1Rect.htm#b234b311011892cfd8a3e831dec341a8" title="Bottom coordinate of the rectangle.">Bottom</a>); glVertex2f(0,     Height);
<a name="l00203"></a>00203             glTexCoord2f(Rect.<a class="code" href="classsf_1_1Rect.htm#6ce87895496327187a20a46dc2479383" title="Right coordinate of the rectangle.">Right</a>, Rect.<a class="code" href="classsf_1_1Rect.htm#b234b311011892cfd8a3e831dec341a8" title="Bottom coordinate of the rectangle.">Bottom</a>); glVertex2f(Width, Height);
<a name="l00204"></a>00204             glTexCoord2f(Rect.<a class="code" href="classsf_1_1Rect.htm#6ce87895496327187a20a46dc2479383" title="Right coordinate of the rectangle.">Right</a>, Rect.<a class="code" href="classsf_1_1Rect.htm#4addcc0bf656fb5f2f80d406cf90c047" title="Top coordinate of the rectangle.">Top</a>);    glVertex2f(Width, 0) ;
<a name="l00205"></a>00205         glEnd();
<a name="l00206"></a>00206     }
<a name="l00207"></a>00207     <span class="keywordflow">else</span>
<a name="l00208"></a>00208     {
<a name="l00209"></a>00209         <span class="comment">// Disable texturing</span>
<a name="l00210"></a>00210         GLCheck(glDisable(GL_TEXTURE_2D));
<a name="l00211"></a>00211 
<a name="l00212"></a>00212         <span class="comment">// Draw the sprite's triangles</span>
<a name="l00213"></a>00213         glBegin(GL_QUADS);
<a name="l00214"></a>00214             glVertex2f(0,     0);
<a name="l00215"></a>00215             glVertex2f(0,     Height);
<a name="l00216"></a>00216             glVertex2f(Width, Height);
<a name="l00217"></a>00217             glVertex2f(Width, 0);
<a name="l00218"></a>00218         glEnd();
<a name="l00219"></a>00219     }
<a name="l00220"></a>00220 }
<a name="l00221"></a>00221 
<a name="l00222"></a>00222 } <span class="comment">// namespace sf</span>
</pre></div></div>

        <p id="footer">
            &nbsp;::&nbsp; Copyright &copy; 2007-2008 Laurent Gomila, all rights reserved &nbsp;::&nbsp;
            Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> &nbsp;::&nbsp;
        </p>

    </body>
</html>