forked from ReClassNET/ReClass.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVector2Node.cs
More file actions
51 lines (44 loc) · 1.39 KB
/
Vector2Node.cs
File metadata and controls
51 lines (44 loc) · 1.39 KB
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
using System.Runtime.InteropServices;
using ReClassNET.UI;
namespace ReClassNET.Nodes
{
public class Vector2Node : BaseMatrixNode
{
[StructLayout(LayoutKind.Explicit)]
struct Vector2Data
{
[FieldOffset(0)]
public float X;
[FieldOffset(4)]
public float Y;
}
/// <summary>Size of the node in bytes.</summary>
public override int MemorySize => 2 * 4;
/// <summary>Draws this node.</summary>
/// <param name="view">The view information.</param>
/// <param name="x">The x coordinate.</param>
/// <param name="y">The y coordinate.</param>
/// <returns>The height the node occupies.</returns>
public override int Draw(ViewInfo view, int x2, int y2)
{
return DrawVectorType(view, x2, y2, "Vector2", (ref int x, ref int y) =>
{
var value = view.Memory.ReadObject<Vector2Data>(Offset);
x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "(");
x = AddText(view, x, y, Program.Settings.ValueColor, 0, $"{value.X:0.000}");
x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ",");
x = AddText(view, x, y, Program.Settings.ValueColor, 1, $"{value.Y:0.000}");
x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ")");
});
}
protected override int CalculateValuesHeight(ViewInfo view)
{
return 0;
}
public override void Update(HotSpot spot)
{
base.Update(spot);
Update(spot, 2);
}
}
}