Skip to content

Commit 8a99987

Browse files
committed
update to latest patch
1 parent 2b514af commit 8a99987

File tree

6 files changed

+111
-120
lines changed

6 files changed

+111
-120
lines changed

PositionalGuide/ConfigWindow.cs

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,39 @@
99

1010
using ImGuiNET;
1111

12-
namespace PrincessRTFM.PositionalGuide;
12+
namespace VariableVixen.PositionalGuide;
1313

1414
public class ConfigWindow: Window, IDisposable {
1515
public const float InactiveOptionAlpha = 0.5f;
1616

17-
private const ImGuiWindowFlags flags = ImGuiWindowFlags.None
17+
private const ImGuiWindowFlags WindowFlags = ImGuiWindowFlags.None
1818
//| ImGuiWindowFlags.NoScrollbar
1919
//| ImGuiWindowFlags.NoScrollWithMouse
2020
| ImGuiWindowFlags.AlwaysAutoResize;
21-
private const int ptrMemWidth = sizeof(short);
22-
23-
private readonly IntPtr stepPtr;
24-
private readonly IntPtr minBoundingPtr;
25-
private readonly IntPtr maxBoundingPtr;
26-
private readonly IntPtr minModifierPtr;
27-
private readonly IntPtr maxModifierPtr;
28-
private readonly IntPtr minThicknessPtr;
29-
private readonly IntPtr maxThicknessPtr;
30-
private readonly IntPtr minOuterCircleRangePtr;
31-
private readonly IntPtr maxOuterCircleRangePtr;
32-
private readonly IntPtr negativeOnePtr;
33-
private readonly IntPtr negativeTwoPtr;
34-
private readonly IntPtr maxTetherLengthPtr;
21+
private const int PtrMemWidth = sizeof(short);
22+
23+
private readonly nint stepPtr;
24+
private readonly nint minBoundingPtr;
25+
private readonly nint maxBoundingPtr;
26+
private readonly nint minModifierPtr;
27+
private readonly nint maxModifierPtr;
28+
private readonly nint minThicknessPtr;
29+
private readonly nint maxThicknessPtr;
30+
private readonly nint minOuterCircleRangePtr;
31+
private readonly nint maxOuterCircleRangePtr;
32+
private readonly nint negativeOnePtr;
33+
private readonly nint negativeTwoPtr;
34+
private readonly nint maxTetherLengthPtr;
3535

3636
private bool disposed;
3737

3838
private readonly Configuration conf;
3939
public delegate void SettingsUpdate();
4040
public event SettingsUpdate? OnSettingsUpdate;
4141

42-
public ConfigWindow(Plugin core) : base(Plugin.Name, flags) {
42+
public ConfigWindow(Plugin core) : base(Plugin.Name, WindowFlags) {
4343
this.RespectCloseHotkey = true;
44-
this.TitleBarButtons = new() {
44+
this.TitleBarButtons = [
4545
new() {
4646
Priority = 0,
4747
Icon = FontAwesomeIcon.Heart,
@@ -64,7 +64,7 @@ public ConfigWindow(Plugin core) : base(Plugin.Name, flags) {
6464
ImGui.EndTooltip();
6565
},
6666
}
67-
};
67+
];
6868
this.AllowClickthrough = true;
6969
this.AllowPinning = true;
7070
this.SizeConstraints = new() {
@@ -73,30 +73,30 @@ public ConfigWindow(Plugin core) : base(Plugin.Name, flags) {
7373

7474
this.conf = core.Config;
7575

76-
this.stepPtr = Marshal.AllocHGlobal(ptrMemWidth);
77-
this.minBoundingPtr = Marshal.AllocHGlobal(ptrMemWidth);
78-
this.maxBoundingPtr = Marshal.AllocHGlobal(ptrMemWidth);
79-
this.minModifierPtr = Marshal.AllocHGlobal(ptrMemWidth);
80-
this.maxModifierPtr = Marshal.AllocHGlobal(ptrMemWidth);
81-
this.minThicknessPtr = Marshal.AllocHGlobal(ptrMemWidth);
82-
this.maxThicknessPtr = Marshal.AllocHGlobal(ptrMemWidth);
83-
this.minOuterCircleRangePtr = Marshal.AllocHGlobal(ptrMemWidth);
84-
this.maxOuterCircleRangePtr = Marshal.AllocHGlobal(ptrMemWidth);
85-
this.negativeOnePtr = Marshal.AllocHGlobal(ptrMemWidth);
86-
this.negativeTwoPtr = Marshal.AllocHGlobal(ptrMemWidth);
87-
this.maxTetherLengthPtr = Marshal.AllocHGlobal(ptrMemWidth);
88-
Marshal.Copy(BitConverter.GetBytes((short)1), 0, this.stepPtr, ptrMemWidth);
89-
Marshal.Copy(BitConverter.GetBytes((short)byte.MinValue), 0, this.minBoundingPtr, ptrMemWidth);
90-
Marshal.Copy(BitConverter.GetBytes((short)byte.MaxValue), 0, this.maxBoundingPtr, ptrMemWidth);
91-
Marshal.Copy(BitConverter.GetBytes((short)sbyte.MinValue), 0, this.minModifierPtr, ptrMemWidth);
92-
Marshal.Copy(BitConverter.GetBytes((short)sbyte.MaxValue), 0, this.maxModifierPtr, ptrMemWidth);
93-
Marshal.Copy(BitConverter.GetBytes((short)1), 0, this.minThicknessPtr, ptrMemWidth);
94-
Marshal.Copy(BitConverter.GetBytes((short)5), 0, this.maxThicknessPtr, ptrMemWidth);
95-
Marshal.Copy(BitConverter.GetBytes((short)byte.MinValue), 0, this.minOuterCircleRangePtr, ptrMemWidth);
96-
Marshal.Copy(BitConverter.GetBytes((short)byte.MaxValue), 0, this.maxOuterCircleRangePtr, ptrMemWidth);
97-
Marshal.Copy(BitConverter.GetBytes((short)-1), 0, this.negativeOnePtr, ptrMemWidth);
98-
Marshal.Copy(BitConverter.GetBytes((short)-2), 0, this.negativeTwoPtr, ptrMemWidth);
99-
Marshal.Copy(BitConverter.GetBytes((short)32), 0, this.maxTetherLengthPtr, ptrMemWidth);
76+
this.stepPtr = Marshal.AllocHGlobal(PtrMemWidth);
77+
this.minBoundingPtr = Marshal.AllocHGlobal(PtrMemWidth);
78+
this.maxBoundingPtr = Marshal.AllocHGlobal(PtrMemWidth);
79+
this.minModifierPtr = Marshal.AllocHGlobal(PtrMemWidth);
80+
this.maxModifierPtr = Marshal.AllocHGlobal(PtrMemWidth);
81+
this.minThicknessPtr = Marshal.AllocHGlobal(PtrMemWidth);
82+
this.maxThicknessPtr = Marshal.AllocHGlobal(PtrMemWidth);
83+
this.minOuterCircleRangePtr = Marshal.AllocHGlobal(PtrMemWidth);
84+
this.maxOuterCircleRangePtr = Marshal.AllocHGlobal(PtrMemWidth);
85+
this.negativeOnePtr = Marshal.AllocHGlobal(PtrMemWidth);
86+
this.negativeTwoPtr = Marshal.AllocHGlobal(PtrMemWidth);
87+
this.maxTetherLengthPtr = Marshal.AllocHGlobal(PtrMemWidth);
88+
Marshal.Copy(BitConverter.GetBytes((short)1), 0, this.stepPtr, PtrMemWidth);
89+
Marshal.Copy(BitConverter.GetBytes((short)byte.MinValue), 0, this.minBoundingPtr, PtrMemWidth);
90+
Marshal.Copy(BitConverter.GetBytes((short)byte.MaxValue), 0, this.maxBoundingPtr, PtrMemWidth);
91+
Marshal.Copy(BitConverter.GetBytes((short)sbyte.MinValue), 0, this.minModifierPtr, PtrMemWidth);
92+
Marshal.Copy(BitConverter.GetBytes((short)sbyte.MaxValue), 0, this.maxModifierPtr, PtrMemWidth);
93+
Marshal.Copy(BitConverter.GetBytes((short)1), 0, this.minThicknessPtr, PtrMemWidth);
94+
Marshal.Copy(BitConverter.GetBytes((short)5), 0, this.maxThicknessPtr, PtrMemWidth);
95+
Marshal.Copy(BitConverter.GetBytes((short)byte.MinValue), 0, this.minOuterCircleRangePtr, PtrMemWidth);
96+
Marshal.Copy(BitConverter.GetBytes((short)byte.MaxValue), 0, this.maxOuterCircleRangePtr, PtrMemWidth);
97+
Marshal.Copy(BitConverter.GetBytes((short)-1), 0, this.negativeOnePtr, PtrMemWidth);
98+
Marshal.Copy(BitConverter.GetBytes((short)-2), 0, this.negativeTwoPtr, PtrMemWidth);
99+
Marshal.Copy(BitConverter.GetBytes((short)32), 0, this.maxTetherLengthPtr, PtrMemWidth);
100100
}
101101

102102
public override void Draw() {
@@ -105,32 +105,32 @@ public override void Draw() {
105105
bool changed = false;
106106

107107
bool[] drawing = this.conf.DrawGuides;
108-
bool[] circleColours = new bool[] {
108+
bool[] circleColours = [
109109
this.conf.AlwaysUseCircleColours,
110110
this.conf.AlwaysUseCircleColoursTarget,
111111
this.conf.AlwaysUseCircleColoursOuter,
112-
};
113-
bool[] limitRender = new bool[] {
112+
];
113+
bool[] limitRender = [
114114
this.conf.OnlyRenderWhenEitherEndOnScreen,
115115
this.conf.OnlyRenderWhenCentreOnScreen,
116116
this.conf.OnlyRenderWhenEndpointOnScreen,
117-
};
117+
];
118118
Vector4[] colours = this.conf.LineColours;
119119

120120
// used to chunk-copy values for the sliders in the config window, since ImGui uses pointers to the values
121-
short[] hack = new short[] {
121+
short[] hack = [
122122
this.conf.ExtraDrawRange,
123123
this.conf.MinDrawRange,
124124
this.conf.MaxDrawRange,
125125
this.conf.LineThickness,
126126
this.conf.OuterCircleRange,
127127
this.conf.TetherLengthInner,
128128
this.conf.TetherLengthOuter,
129-
};
130-
IntPtr[] ptrs = new IntPtr[hack.Length];
129+
];
130+
nint[] ptrs = new nint[hack.Length];
131131
for (int i = 0; i < hack.Length; ++i) {
132-
ptrs[i] = Marshal.AllocHGlobal(ptrMemWidth);
133-
Marshal.Copy(BitConverter.GetBytes(hack[i]), 0, ptrs[i], ptrMemWidth);
132+
ptrs[i] = Marshal.AllocHGlobal(PtrMemWidth);
133+
Marshal.Copy(BitConverter.GetBytes(hack[i]), 0, ptrs[i], PtrMemWidth);
134134
}
135135

136136
bool active = this.conf.Enabled;
@@ -193,8 +193,8 @@ public override void Draw() {
193193
// now we do the 3x3 for guidelines and the target ring
194194
ImGui.TextUnformatted("\nWhich guidelines do you want, and in what colours?");
195195
foreach (int i in new int[] { 7, 0, 1,
196-
6, 8, 2, 9,
197-
5, 4, 3 }) { // awful ugly hack, sorry
196+
6, 8, 2, 9,
197+
5, 4, 3 }) { // awful ugly hack, sorry
198198
changed |= ImGui.Checkbox($"###drawGuide{i}", ref drawing[i]);
199199
utils.Tooltip($"Draw the {Configuration.Directions[i]}?");
200200
ImGui.SameLine();

PositionalGuide/Configuration.cs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
using Newtonsoft.Json;
77

8-
namespace PrincessRTFM.PositionalGuide;
8+
namespace VariableVixen.PositionalGuide;
99

1010
public class Configuration: IPluginConfiguration {
1111
public const int
@@ -19,7 +19,7 @@ public const int
1919
IndexFrontLeft = 7,
2020
IndexCircle = 8,
2121
IndexOuterCircle = 9;
22-
public static readonly string[] Directions = new string[] {
22+
public static readonly string[] Directions = [
2323
"front guideline",
2424
"front right guideline",
2525
"right guideline",
@@ -30,7 +30,7 @@ public const int
3030
"front left guideline",
3131
"target circle",
3232
"outer circle",
33-
};
33+
];
3434

3535
public int Version { get; set; } = 1;
3636

@@ -49,7 +49,7 @@ public const int
4949
/// <summary>
5050
/// Starts at front then goes clockwise up to index=7, then circle at index=8
5151
/// </summary>
52-
public bool[] DrawGuides { get; set; } = new bool[] {
52+
public bool[] DrawGuides { get; set; } = [
5353
false, // front
5454
false, // front right
5555
false, // right
@@ -60,7 +60,7 @@ public const int
6060
false, // front left
6161
false, // circle
6262
false, // outer circle
63-
};
63+
];
6464

6565
public short ExtraDrawRange { get; set; } = 0;
6666
public short MinDrawRange { get; set; } = 0;
@@ -75,7 +75,7 @@ public const int
7575
/// <summary>
7676
/// Starts at front then goes clockwise up to index=7, then circle at index=8 and outer circle at index=9
7777
/// </summary>
78-
public Vector4[] LineColours { get; set; } = new Vector4[] {
78+
public Vector4[] LineColours { get; set; } = [
7979
new(1, 0, 0, 1), // front
8080
new(1, 0, 0, 1), // front right
8181
new(0, 0, 1, 1), // right
@@ -86,20 +86,18 @@ public const int
8686
new(1, 0, 0, 1), // front left
8787
new(1, 1, 0, 1), // circle default
8888
new(1, 1, 0, 1), // outer circle default
89-
};
89+
];
9090

9191
public void Update() {
9292
int initalLength = this.DrawGuides.Length;
9393
if (initalLength < 10) {
9494
bool[] guides = new bool[10];
9595
Array.Copy(this.DrawGuides, guides, this.DrawGuides.Length);
9696

97-
if (initalLength < 9) {
97+
if (initalLength < 9)
9898
guides[8] = false;
99-
}
100-
if (initalLength < 10) {
99+
if (initalLength < 10)
101100
guides[9] = false;
102-
}
103101

104102
this.DrawGuides = guides;
105103
}
@@ -109,12 +107,10 @@ public void Update() {
109107
Vector4[] colours = new Vector4[10];
110108
Array.Copy(this.LineColours, colours, this.LineColours.Length);
111109

112-
if (initalLength < 9) {
110+
if (initalLength < 9)
113111
colours[8] = new Vector4(1, 1, 0, 1);
114-
}
115-
if (initalLength < 10) {
112+
if (initalLength < 10)
116113
colours[9] = new Vector4(1, 1, 0, 1);
117-
}
118114

119115
this.LineColours = colours;
120116
}

PositionalGuide/DrawGuides.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22

3-
namespace PrincessRTFM.PositionalGuide;
3+
namespace VariableVixen.PositionalGuide;
44

55
[Flags]
66
public enum DrawGuides: ushort {

PositionalGuide/ImGuitils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
using ImGuiNET;
44

5-
namespace PrincessRTFM.PositionalGuide;
5+
namespace VariableVixen.PositionalGuide;
66

77
internal class ImGuitils {
88
public int TooltipPixelWrapWidth;

0 commit comments

Comments
 (0)