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

◆ DrawMarkedArea()

void Terraria.Graphics.Capture.CaptureInterface.ModeDragBounds.DrawMarkedArea ( SpriteBatch sb)
inline

Definition at line 562 of file CaptureInterface.cs.

563 {
564 if (!EdgeAPinned || !EdgeBPinned)
565 {
566 return;
567 }
568 int num = Math.Min(EdgeA.X, EdgeB.X);
569 int num2 = Math.Min(EdgeA.Y, EdgeB.Y);
570 int num3 = Math.Abs(EdgeA.X - EdgeB.X);
571 int num4 = Math.Abs(EdgeA.Y - EdgeB.Y);
572 Rectangle result;
573 if (!Main.mapFullscreen)
574 {
575 Rectangle value = Main.ReverseGravitySupport(new Rectangle(num * 16, num2 * 16, (num3 + 1) * 16, (num4 + 1) * 16));
576 Rectangle value2 = Main.ReverseGravitySupport(new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth + 1, Main.screenHeight + 1));
578 if (result.Width == 0 || result.Height == 0)
579 {
580 return;
581 }
582 result.Offset(-value2.X, -value2.Y);
583 }
584 else
585 {
586 GetMapCoords(num, num2, 1, out var result2);
587 GetMapCoords(num + num3 + 1, num2 + num4 + 1, 1, out var result3);
589 Rectangle value2 = new Rectangle(0, 0, Main.screenWidth + 1, Main.screenHeight + 1);
591 if (result.Width == 0 || result.Height == 0)
592 {
593 return;
594 }
595 result.Offset(-value2.X, -value2.Y);
596 }
597 sb.Draw(TextureAssets.MagicPixel.Value, result, Settings.MarkedAreaColor);
599 for (int i = 0; i < 2; i++)
600 {
601 if (currentAim != i)
602 {
603 DrawBound(sb, new Rectangle(result.X, result.Y + ((i == 1) ? result.Height : (-2)), result.Width, 2), 0);
604 }
605 else
606 {
607 rectangle = new Rectangle(result.X, result.Y + ((i == 1) ? result.Height : (-2)), result.Width, 2);
608 }
609 if (currentAim != i + 2)
610 {
611 DrawBound(sb, new Rectangle(result.X + ((i == 1) ? result.Width : (-2)), result.Y, 2, result.Height), 0);
612 }
613 else
614 {
615 rectangle = new Rectangle(result.X + ((i == 1) ? result.Width : (-2)), result.Y, 2, result.Height);
616 }
617 }
619 {
620 DrawBound(sb, rectangle, 1 + dragging.ToInt());
621 }
622 }
void Draw(Texture2D texture, Vector2 position, Color color)
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Abs(double value)
static Asset< Texture2D > MagicPixel
void DrawBound(SpriteBatch sb, Rectangle r, int mode)
static bool GetMapCoords(int PinX, int PinY, int Goal, out Point result)
static Rectangle Intersect(Rectangle value1, Rectangle value2)
Definition Rectangle.cs:143

References System.Math.Abs(), Terraria.Graphics.Capture.CaptureInterface.ModeDragBounds.currentAim, Terraria.Graphics.Capture.CaptureInterface.ModeDragBounds.dragging, Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.Graphics.Capture.CaptureInterface.ModeDragBounds.DrawBound(), Terraria.Graphics.Capture.CaptureInterface.EdgeA, Terraria.Graphics.Capture.CaptureInterface.EdgeAPinned, Terraria.Graphics.Capture.CaptureInterface.EdgeB, Terraria.Graphics.Capture.CaptureInterface.EdgeBPinned, Microsoft.Xna.Framework.Rectangle.Empty, Terraria.Graphics.Capture.CaptureInterface.GetMapCoords(), Microsoft.Xna.Framework.Rectangle.Height, Microsoft.Xna.Framework.Rectangle.Intersect(), Terraria.GameContent.TextureAssets.MagicPixel, Terraria.Main.mapFullscreen, Terraria.Graphics.Capture.CaptureInterface.Settings.MarkedAreaColor, System.Math.Min(), Terraria.Main.ReverseGravitySupport(), Terraria.Main.screenHeight, Terraria.Main.screenPosition, Terraria.Main.screenWidth, System.value, Microsoft.Xna.Framework.Rectangle.Width, Microsoft.Xna.Framework.Rectangle.X, and Microsoft.Xna.Framework.Rectangle.Y.

Referenced by Terraria.Graphics.Capture.CaptureInterface.ModeDragBounds.Draw().