Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BasicDebugDrawer.cs
Go to the documentation of this file.
1using System;
4
6
8{
10
12
13 private bool _disposedValue;
14
15 public BasicDebugDrawer(GraphicsDevice graphicsDevice)
16 {
17 //IL_0008: Unknown result type (might be due to invalid IL or missing references)
18 //IL_0012: Expected O, but got Unknown
19 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
20 //IL_0020: Expected O, but got Unknown
21 //IL_002e: Unknown result type (might be due to invalid IL or missing references)
22 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
23 _spriteBatch = new SpriteBatch(graphicsDevice);
24 _texture = new Texture2D(graphicsDevice, 4, 4);
25 Color[] array = (Color[])(object)new Color[16];
26 for (int i = 0; i < array.Length; i++)
27 {
28 array[i] = Color.White;
29 }
30 _texture.SetData<Color>(array);
31 }
32
33 public void Begin(Matrix matrix)
34 {
35 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
37 }
38
39 public void Begin()
40 {
42 }
43
44 public void DrawSquare(Vector4 positionAndSize, Color color)
45 {
46 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
47 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
48 //IL_0018: Unknown result type (might be due to invalid IL or missing references)
49 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
50 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
51 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
52 //IL_0037: Unknown result type (might be due to invalid IL or missing references)
53 //IL_003d: Unknown result type (might be due to invalid IL or missing references)
54 //IL_0047: Unknown result type (might be due to invalid IL or missing references)
55 _spriteBatch.Draw(_texture, new Vector2(positionAndSize.X, positionAndSize.Y), (Rectangle?)null, color, 0f, Vector2.Zero, new Vector2(positionAndSize.Z, positionAndSize.W) / 4f, (SpriteEffects)0, 1f);
56 }
57
58 public void DrawSquare(Vector2 position, Vector2 size, Color color)
59 {
60 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
61 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
62 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
63 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
64 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
65 _spriteBatch.Draw(_texture, position, (Rectangle?)null, color, 0f, Vector2.Zero, size / 4f, (SpriteEffects)0, 1f);
66 }
67
68 public void DrawSquareFromCenter(Vector2 center, Vector2 size, float rotation, Color color)
69 {
70 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
71 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
72 //IL_0023: Unknown result type (might be due to invalid IL or missing references)
73 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
74 //IL_002e: Unknown result type (might be due to invalid IL or missing references)
75 _spriteBatch.Draw(_texture, center, (Rectangle?)null, color, rotation, new Vector2(2f, 2f), size / 4f, (SpriteEffects)0, 1f);
76 }
77
78 public void DrawLine(Vector2 start, Vector2 end, float width, Color color)
79 {
80 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
81 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
82 //IL_0002: Unknown result type (might be due to invalid IL or missing references)
83 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
84 //IL_0008: Unknown result type (might be due to invalid IL or missing references)
85 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
86 //IL_0038: Unknown result type (might be due to invalid IL or missing references)
87 //IL_0042: Unknown result type (might be due to invalid IL or missing references)
88 //IL_004f: Unknown result type (might be due to invalid IL or missing references)
89 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
90 //IL_005a: Unknown result type (might be due to invalid IL or missing references)
91 Vector2 vector = end - start;
92 float rotation = (float)Math.Atan2(vector.Y, vector.X);
93 Vector2 vector2 = default(Vector2);
94 ((Vector2)(ref vector2))._002Ector(((Vector2)(ref vector)).Length(), width);
95 _spriteBatch.Draw(_texture, start, (Rectangle?)null, color, rotation, new Vector2(0f, 2f), vector2 / 4f, (SpriteEffects)0, 1f);
96 }
97
98 public void End()
99 {
101 }
102
103 protected virtual void Dispose(bool disposing)
104 {
105 if (_disposedValue)
106 {
107 return;
108 }
109 if (disposing)
110 {
111 if (_spriteBatch != null)
112 {
113 ((GraphicsResource)_spriteBatch).Dispose();
114 _spriteBatch = null;
115 }
116 if (_texture != null)
117 {
119 _texture = null;
120 }
121 }
122 _disposedValue = true;
123 }
124
125 public void Dispose()
126 {
127 Dispose(disposing: true);
128 }
129}
void Draw(Texture2D texture, Vector2 position, Color color)
override void Dispose(bool disposing)
virtual void Dispose(bool disposing)
void DrawSquare(Vector4 positionAndSize, Color color)
void DrawSquareFromCenter(Vector2 center, Vector2 size, float rotation, Color color)
BasicDebugDrawer(GraphicsDevice graphicsDevice)
void DrawLine(Vector2 start, Vector2 end, float width, Color color)
void DrawSquare(Vector2 position, Vector2 size, Color color)
static double Atan2(double y, double x)