Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Draw() [7/7]

void Terraria.DataStructures.SpriteDrawBuffer.Draw ( Texture2D texture,
Vector4 destinationRectangle,
Rectangle? sourceRectangle,
VertexColors colors,
float rotation,
Vector2 origin,
SpriteEffects effect,
float depth )
inline

Definition at line 158 of file SpriteDrawBuffer.cs.

159 {
160 Vector4 sourceRectangle2 = default(Vector4);
161 if (sourceRectangle.HasValue)
162 {
163 sourceRectangle2.X = sourceRectangle.Value.X;
164 sourceRectangle2.Y = sourceRectangle.Value.Y;
165 sourceRectangle2.Z = sourceRectangle.Value.Width;
166 sourceRectangle2.W = sourceRectangle.Value.Height;
167 }
168 else
169 {
170 sourceRectangle2.X = 0f;
171 sourceRectangle2.Y = 0f;
172 sourceRectangle2.Z = texture.Width;
173 sourceRectangle2.W = texture.Height;
174 }
175 Vector2 texCoordTL = default(Vector2);
176 texCoordTL.X = sourceRectangle2.X / (float)texture.Width;
177 texCoordTL.Y = sourceRectangle2.Y / (float)texture.Height;
178 Vector2 texCoordBR = default(Vector2);
179 texCoordBR.X = (sourceRectangle2.X + sourceRectangle2.Z) / (float)texture.Width;
180 texCoordBR.Y = (sourceRectangle2.Y + sourceRectangle2.W) / (float)texture.Height;
181 if ((effect & SpriteEffects.FlipVertically) != 0)
182 {
183 float y = texCoordBR.Y;
184 texCoordBR.Y = texCoordTL.Y;
185 texCoordTL.Y = y;
186 }
187 if ((effect & SpriteEffects.FlipHorizontally) != 0)
188 {
189 float x = texCoordBR.X;
190 texCoordBR.X = texCoordTL.X;
191 texCoordTL.X = x;
192 }
193 QueueSprite(destinationRectangle, -origin, colors, sourceRectangle2, texCoordTL, texCoordBR, texture, depth, rotation);
194 }
void QueueSprite(Vector4 destinationRect, Vector2 origin, VertexColors colors, Vector4 sourceRectangle, Vector2 texCoordTL, Vector2 texCoordBR, Texture2D texture, float depth, float rotation)

References Microsoft.Xna.Framework.Graphics.Texture2D.Height, Microsoft.Xna.Framework.Rectangle.Height, Terraria.DataStructures.SpriteDrawBuffer.QueueSprite(), Microsoft.Xna.Framework.Vector4.W, Microsoft.Xna.Framework.Graphics.Texture2D.Width, Microsoft.Xna.Framework.Rectangle.Width, Microsoft.Xna.Framework.Rectangle.X, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Rectangle.Y, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector4.Z.