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

◆ InternalDraw()

unsafe void Microsoft.Xna.Framework.Graphics.SpriteBatch.InternalDraw ( Texture2D texture,
ref Vector4 destination,
bool scaleDestination,
ref Rectangle? sourceRectangle,
Color color,
float rotation,
ref Vector2 origin,
SpriteEffects effects,
float depth )
inlineprivate

Definition at line 559 of file SpriteBatch.cs.

560 {
561 if (texture == null)
562 {
563 throw new ArgumentNullException("texture", FrameworkResources.NullNotAllowed);
564 }
565 if (!inBeginEndPair)
566 {
567 throw new InvalidOperationException(FrameworkResources.BeginMustBeCalledBeforeDraw);
568 }
569 if (spriteQueueCount >= spriteQueue.Length)
570 {
571 Array.Resize(ref spriteQueue, spriteQueue.Length * 2);
572 }
573 fixed (SpriteInfo* ptr = &spriteQueue[spriteQueueCount])
574 {
575 float num = destination.Z;
576 float num2 = destination.W;
577 if (sourceRectangle.HasValue)
578 {
579 Rectangle value = sourceRectangle.Value;
580 ptr->Source.X = value.X;
581 ptr->Source.Y = value.Y;
582 ptr->Source.Z = value.Width;
583 ptr->Source.W = value.Height;
585 {
586 num *= (float)value.Width;
587 num2 *= (float)value.Height;
588 }
589 }
590 else
591 {
592 float num3 = texture.Width;
593 float num4 = texture.Height;
594 ptr->Source.X = 0f;
595 ptr->Source.Y = 0f;
596 ptr->Source.Z = num3;
597 ptr->Source.W = num4;
599 {
600 num *= num3;
601 num2 *= num4;
602 }
603 }
604 ptr->Destination.X = destination.X;
605 ptr->Destination.Y = destination.Y;
606 ptr->Destination.Z = num;
607 ptr->Destination.W = num2;
608 ptr->Origin.X = origin.X;
609 ptr->Origin.Y = origin.Y;
610 ptr->Rotation = rotation;
611 ptr->Depth = depth;
612 ptr->Effects = effects;
613 ptr->Color = color;
614 }
615 if (spriteSortMode == SpriteSortMode.Immediate)
616 {
617 RenderBatch(texture, spriteQueue, 0, 1);
618 return;
619 }
620 if (spriteTextures == null || spriteTextures.Length != spriteQueue.Length)
621 {
622 Array.Resize(ref spriteTextures, spriteQueue.Length);
623 }
626 }
void RenderBatch(Texture2D texture, SpriteInfo[] sprites, int offset, int count)

References Microsoft.Xna.Framework.FrameworkResources.BeginMustBeCalledBeforeDraw, System.destination, Microsoft.Xna.Framework.Graphics.Texture2D.Height, Microsoft.Xna.Framework.Graphics.SpriteBatch.inBeginEndPair, Microsoft.Xna.Framework.FrameworkResources.NullNotAllowed, Microsoft.Xna.Framework.Graphics.SpriteBatch.RenderBatch(), Microsoft.Xna.Framework.Graphics.SpriteBatch.spriteQueue, Microsoft.Xna.Framework.Graphics.SpriteBatch.spriteQueueCount, Microsoft.Xna.Framework.Graphics.SpriteBatch.spriteSortMode, Microsoft.Xna.Framework.Graphics.SpriteBatch.spriteTextures, System.value, and Microsoft.Xna.Framework.Graphics.Texture2D.Width.

Referenced by Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), and Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw().