99
1010using ImGuiNET ;
1111
12- namespace PrincessRTFM . PositionalGuide ;
12+ namespace VariableVixen . PositionalGuide ;
1313
1414public 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 ( "\n Which 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 ( ) ;
0 commit comments