|
1 |
| -using System; |
| 1 | +using System; |
2 | 2 | using System.Collections.Generic;
|
3 | 3 | using Silk.NET.SDL;
|
4 | 4 |
|
@@ -76,30 +76,54 @@ public void DoEvent(Event @event)
|
76 | 76 | {
|
77 | 77 | case GameControllerAxis.ControllerAxisLeftx:
|
78 | 78 | {
|
79 |
| - _thumbsticksChanged[0] = true; |
80 |
| - _thumbsticks[0] = new Thumbstick |
81 |
| - (0, (float) @event.Caxis.Value / short.MaxValue, _thumbsticks[0].Y); |
| 79 | + var thumbstick0 = new Thumbstick(0, |
| 80 | + Deadzone.Apply((float) @event.Caxis.Value / short.MaxValue), |
| 81 | + Deadzone.Apply(_thumbsticks[0].Y)); |
| 82 | + |
| 83 | + if (thumbstick0.X != _thumbsticks[0].X) |
| 84 | + { |
| 85 | + _thumbsticksChanged[0] = true; |
| 86 | + } |
| 87 | + _thumbsticks[0] = thumbstick0; |
82 | 88 | break;
|
83 | 89 | }
|
84 | 90 | case GameControllerAxis.ControllerAxisLefty:
|
85 | 91 | {
|
86 |
| - _thumbsticksChanged[0] = true; |
87 |
| - _thumbsticks[0] = new Thumbstick |
88 |
| - (0, _thumbsticks[0].X, (float) @event.Caxis.Value / short.MaxValue); |
| 92 | + var thumbstick0 = new Thumbstick(0, |
| 93 | + Deadzone.Apply(_thumbsticks[0].X), |
| 94 | + Deadzone.Apply((float) @event.Caxis.Value / short.MaxValue)); |
| 95 | + |
| 96 | + if (thumbstick0.Y != _thumbsticks[0].Y) |
| 97 | + { |
| 98 | + _thumbsticksChanged[0] = true; |
| 99 | + } |
| 100 | + _thumbsticks[0] = thumbstick0; |
89 | 101 | break;
|
90 | 102 | }
|
91 | 103 | case GameControllerAxis.ControllerAxisRightx:
|
92 | 104 | {
|
93 |
| - _thumbsticksChanged[1] = true; |
94 |
| - _thumbsticks[1] = new Thumbstick |
95 |
| - (1, (float) @event.Caxis.Value / short.MaxValue, _thumbsticks[1].Y); |
| 105 | + var thumbstick1 = new Thumbstick(1, |
| 106 | + Deadzone.Apply((float) @event.Caxis.Value / short.MaxValue), |
| 107 | + Deadzone.Apply(_thumbsticks[1].Y)); |
| 108 | + |
| 109 | + if (thumbstick1.X != _thumbsticks[1].X) |
| 110 | + { |
| 111 | + _thumbsticksChanged[1] = true; |
| 112 | + } |
| 113 | + _thumbsticks[1] = thumbstick1; |
96 | 114 | break;
|
97 | 115 | }
|
98 | 116 | case GameControllerAxis.ControllerAxisRighty:
|
99 | 117 | {
|
100 |
| - _thumbsticksChanged[1] = true; |
101 |
| - _thumbsticks[1] = new Thumbstick |
102 |
| - (1, _thumbsticks[1].X, (float) @event.Caxis.Value / short.MaxValue); |
| 118 | + var thumbstick1 = new Thumbstick(1, |
| 119 | + Deadzone.Apply(_thumbsticks[1].X), |
| 120 | + Deadzone.Apply((float) @event.Caxis.Value / short.MaxValue)); |
| 121 | + |
| 122 | + if (thumbstick1.Y != _thumbsticks[1].Y) |
| 123 | + { |
| 124 | + _thumbsticksChanged[1] = true; |
| 125 | + } |
| 126 | + _thumbsticks[1] = thumbstick1; |
103 | 127 | break;
|
104 | 128 | }
|
105 | 129 | case GameControllerAxis.ControllerAxisTriggerleft:
|
|
0 commit comments