diff --git a/src/Input/Silk.NET.Input.Sdl/SdlGamepad.cs b/src/Input/Silk.NET.Input.Sdl/SdlGamepad.cs index 7453d3d5d3..68a17943c5 100644 --- a/src/Input/Silk.NET.Input.Sdl/SdlGamepad.cs +++ b/src/Input/Silk.NET.Input.Sdl/SdlGamepad.cs @@ -128,14 +128,14 @@ public void DoEvent(Event @event) } case GameControllerAxis.ControllerAxisTriggerleft: { - TriggerMoved?.Invoke - (this, _triggers[0] = new Trigger(0, (float) @event.Caxis.Value / short.MaxValue)); + _triggers[0] = new Trigger(0, (float) @event.Caxis.Value / short.MaxValue); + TriggerMoved?.Invoke(this, _triggers[0]); break; } case GameControllerAxis.ControllerAxisTriggerright: { - TriggerMoved?.Invoke - (this, _triggers[1] = new Trigger(1, (float) @event.Caxis.Value / short.MaxValue)); + _triggers[1] = new Trigger(1, (float) @event.Caxis.Value / short.MaxValue); + TriggerMoved?.Invoke(this, _triggers[1]); break; } } @@ -145,15 +145,15 @@ public void DoEvent(Event @event) case EventType.Controllerbuttondown: { var ogBtn = _buttons[@event.Cbutton.Button]; - ButtonDown?.Invoke - (this, _buttons[@event.Cbutton.Button] = new Button(ogBtn.Name, ogBtn.Index, true)); + _buttons[@event.Cbutton.Button] = new Button(ogBtn.Name, ogBtn.Index, true); + ButtonDown?.Invoke(this, _buttons[@event.Cbutton.Button]); break; } case EventType.Controllerbuttonup: { var ogBtn = _buttons[@event.Cbutton.Button]; - ButtonUp?.Invoke - (this, _buttons[@event.Cbutton.Button] = new Button(ogBtn.Name, ogBtn.Index, false)); + _buttons[@event.Cbutton.Button] = new Button(ogBtn.Name, ogBtn.Index, false); + ButtonUp?.Invoke(this, _buttons[@event.Cbutton.Button]); break; } case EventType.Controllerdeviceadded: diff --git a/src/Input/Silk.NET.Input.Sdl/SdlJoystick.cs b/src/Input/Silk.NET.Input.Sdl/SdlJoystick.cs index 79493f2081..b25137a796 100644 --- a/src/Input/Silk.NET.Input.Sdl/SdlJoystick.cs +++ b/src/Input/Silk.NET.Input.Sdl/SdlJoystick.cs @@ -52,12 +52,9 @@ public void DoEvent(Event @event) Array.Resize(ref _axes, @event.Jaxis.Axis + 1); } - AxisMoved?.Invoke - ( - this, - _axes[@event.Jaxis.Axis] = new Axis - (@event.Jaxis.Axis, (float) @event.Jaxis.Value / short.MaxValue) - ); + _axes[@event.Jaxis.Axis] = new Axis + (@event.Jaxis.Axis, (float) @event.Jaxis.Value / short.MaxValue); + AxisMoved?.Invoke(this, _axes[@event.Jaxis.Axis]); break; } case EventType.Joyballmotion: @@ -73,17 +70,14 @@ public void DoEvent(Event @event) } var val = @event.Jhat.Value; - HatMoved?.Invoke + _hats[@event.Jhat.Hat] = new Hat ( - this, - _hats[@event.Jhat.Hat] = new Hat - ( - @event.Jhat.Hat, (Position2D) ((val & 0x01) * (int) Position2D.Up + - (val & 0x02) * (int) Position2D.Right + - (val & 0x04) * (int) Position2D.Down + - (val & 0x08) * (int) Position2D.Left) - ) + @event.Jhat.Hat, (Position2D) ((val & 0x01) * (int) Position2D.Up + + (val & 0x02) * (int) Position2D.Right + + (val & 0x04) * (int) Position2D.Down + + (val & 0x08) * (int) Position2D.Left) ); + HatMoved?.Invoke(this, _hats[@event.Jhat.Hat]); break; } case EventType.Joybuttondown: @@ -93,12 +87,9 @@ public void DoEvent(Event @event) Array.Resize(ref _buttons, @event.Jbutton.Button + 1); } - ButtonDown?.Invoke - ( - this, - _buttons[@event.Jbutton.Button] = new Button - ((ButtonName) @event.Jbutton.Button, @event.Jbutton.Button, true) - ); + _buttons[@event.Jbutton.Button] = new Button + ((ButtonName) @event.Jbutton.Button, @event.Jbutton.Button, true); + ButtonDown?.Invoke(this, _buttons[@event.Jbutton.Button]); break; } case EventType.Joybuttonup: @@ -108,12 +99,9 @@ public void DoEvent(Event @event) Array.Resize(ref _buttons, @event.Jbutton.Button + 1); } - ButtonUp?.Invoke - ( - this, - _buttons[@event.Jbutton.Button] = new Button - ((ButtonName) @event.Jbutton.Button, @event.Jbutton.Button, false) - ); + _buttons[@event.Jbutton.Button] = new Button + ((ButtonName) @event.Jbutton.Button, @event.Jbutton.Button, false); + ButtonUp?.Invoke(this, _buttons[@event.Jbutton.Button]); break; } case EventType.Joydeviceadded: