-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathVector2Node.cs
More file actions
53 lines (45 loc) · 1.45 KB
/
Vector2Node.cs
File metadata and controls
53 lines (45 loc) · 1.45 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
52
53
using System.Drawing;
using System.Runtime.InteropServices;
using ReClassNET.UI;
namespace ReClassNET.Nodes
{
public class Vector2Node : BaseMatrixNode
{
[StructLayout(LayoutKind.Explicit)]
private struct Vector2Data
{
[FieldOffset(0)]
public readonly float X;
[FieldOffset(4)]
public readonly float Y;
}
public override int ValueTypeSize => sizeof(float);
public override int MemorySize => 2 * ValueTypeSize;
/// <summary>Draws this node.</summary>
/// <param name="view">The view information.</param>
/// <param name="x2">The x coordinate.</param>
/// <param name="y2">The y coordinate.</param>
/// <returns>The pixel size the node occupies.</returns>
public override Size 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, view.Settings.NameColor, HotSpot.NoneId, "(");
x = AddText(view, x, y, view.Settings.ValueColor, 0, $"{value.X:0.000}");
x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ",");
x = AddText(view, x, y, view.Settings.ValueColor, 1, $"{value.Y:0.000}");
x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ")");
});
}
protected override int CalculateValuesHeight(ViewInfo view)
{
return 0;
}
public override void Update(HotSpot spot)
{
base.Update(spot);
Update(spot, 2);
}
}
}