-
Notifications
You must be signed in to change notification settings - Fork 1
/
PoMDebug.cs
88 lines (84 loc) · 3.73 KB
/
PoMDebug.cs
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
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
using Terraria;
using Terraria.Utilities;
namespace PathOfModifiers
{
public static class PoMDebug
{
public static List<Point> tiles = new List<Point>();
public static List<Rectangle> tileBounds = new List<Rectangle>();
public static List<Rectangle> recs = new List<Rectangle>();
public static void Draw(SpriteBatch sb)
{
if (tileBounds.Count == 0)
{
List<Point> tiles = new List<Point>();
UnifiedRandom rand = new UnifiedRandom(52222222);
foreach (Rectangle rec in tileBounds)
{
Color color = new Color(rand.Next(256), rand.Next(256), rand.Next(256));
for (int x = 0; x <= rec.Width; x++)
{
Vector2 drawPos = new Vector2((rec.X + x) * 16, rec.Y * 16) - Main.screenPosition;
Point p1 = new Point((int)drawPos.X + 2, (int)drawPos.Y + 2);
int size1 = 12;
if (tiles.Contains(p1))
{
size1 -= 2;
}
else
{
tiles.Add(p1);
}
Point p2 = new Point((int)drawPos.X + 2, (int)drawPos.Y + rec.Height * 16 + 2);
int size2 = 12;
if (tiles.Contains(p2))
{
size2 -= 2;
}
else
{
tiles.Add(p2);
}
sb.Draw(Terraria.GameContent.TextureAssets.MagicPixel.Value, new Rectangle(p1.X, p1.Y, size1, size1), color);
sb.Draw(Terraria.GameContent.TextureAssets.MagicPixel.Value, new Rectangle(p2.X, p2.Y, size2, size2), color);
}
for (int y = 0; y <= rec.Height; y++)
{
Vector2 drawPos = new Vector2(rec.X * 16, (rec.Y + y) * 16) - Main.screenPosition;
Point p1 = new Point((int)drawPos.X + 2, (int)drawPos.Y + 2);
int size1 = 12;
if (tiles.Contains(p1))
{
size1 -= 2;
}
else
{
tiles.Add(p1);
}
Point p2 = new Point((int)drawPos.X + rec.Width * 16 + 2, (int)drawPos.Y + 2);
int size2 = 12;
if (tiles.Contains(p2))
{
size2 -= 2;
}
else
{
tiles.Add(p2);
}
sb.Draw(Terraria.GameContent.TextureAssets.MagicPixel.Value, new Rectangle(p1.X, p1.Y, size1, size1), color);
sb.Draw(Terraria.GameContent.TextureAssets.MagicPixel.Value, new Rectangle(p2.X, p2.Y, size2, size2), color);
}
}
}
foreach (Rectangle rect in recs)
{
Rectangle sourceRect = new Rectangle(0, 0, 1, 1);
Rectangle screenRect = new Rectangle(rect.X - (int)Main.screenPosition.X, rect.Y - (int)Main.screenPosition.Y, rect.Width, rect.Height);
sb.Draw(Terraria.GameContent.TextureAssets.MagicPixel.Value, screenRect, sourceRect, Color.Red);
}
}
}
}