|
1 | 1 | using SharpDX.XInput;
|
2 | 2 | using System;
|
3 |
| -using System.Drawing; |
4 | 3 | using System.Linq;
|
5 | 4 | using System.Numerics;
|
6 |
| -using System.Windows.Forms; |
7 | 5 | using Windows.Devices.Sensors;
|
8 | 6 |
|
9 | 7 | namespace AyaGyroAiming
|
@@ -32,7 +30,7 @@ public class XInputGirometer
|
32 | 30 | float GyroStickAlpha = 0.2f;
|
33 | 31 | float GyroStickMagnitude = 3.5f;
|
34 | 32 | float GyroStickThreshold = 0.1f;
|
35 |
| - float GyroStickRatio = 1.7f; |
| 33 | + float GyroStickRange = 10000.0f; |
36 | 34 |
|
37 | 35 | // Settings
|
38 | 36 | Settings settings;
|
@@ -60,10 +58,6 @@ public void UpdateSettings(Settings _settings)
|
60 | 58 | {
|
61 | 59 | settings = _settings;
|
62 | 60 |
|
63 |
| - // resolution settings |
64 |
| - Rectangle resolution = Screen.PrimaryScreen.Bounds; |
65 |
| - GyroStickRatio = settings.MonitorRatio ? ((float)resolution.Width / (float)resolution.Height) : 1.0f; |
66 |
| - |
67 | 61 | poolsize = settings.MaxSample;
|
68 | 62 | gyroPool = new Vector3[poolsize];
|
69 | 63 |
|
@@ -126,8 +120,10 @@ void GyroReadingChanged(Gyrometer sender, GyrometerReadingChangedEventArgs args)
|
126 | 120 | Z = (float)(settings.InvertAxisZ ? 1.0f : -1.0f) * (float)gyroPool.Select(a => a.Z).Average(),
|
127 | 121 | };
|
128 | 122 |
|
129 |
| - posAverage *= settings.Range; |
130 |
| - posAverage.X *= GyroStickRatio; // take screen ratio in consideration 1.7f (16:9) |
| 123 | + posAverage *= GyroStickRange; |
| 124 | + posAverage.X *= settings.RangeAxisX; |
| 125 | + posAverage.Y *= settings.RangeAxisY; |
| 126 | + posAverage.Z *= settings.RangeAxisZ; |
131 | 127 |
|
132 | 128 | posAverage.X = (float)(Math.Sign(posAverage.X) * Math.Pow(Math.Abs(posAverage.X) / Gamepad.RightThumbDeadZone, settings.Aggressivity) * Gamepad.RightThumbDeadZone);
|
133 | 129 | posAverage.Y = (float)(Math.Sign(posAverage.Y) * Math.Pow(Math.Abs(posAverage.Y) / Gamepad.RightThumbDeadZone, settings.Aggressivity) * Gamepad.RightThumbDeadZone);
|
|
0 commit comments