Skip to content

Commit ced69ae

Browse files
committed
Remove some weak events to test
1 parent a34bd86 commit ced69ae

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

engine/Orbit.Input/GameControllers/GameController.cs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ namespace Orbit.Input;
77
/// </summary>
88
public partial class GameController
99
{
10-
private readonly WeakEventManager weakEventManager = new();
11-
1210
public string Name { get; private set; } = string.Empty;
1311

1412
/// <summary>
@@ -87,30 +85,22 @@ internal void RaiseUnmappedButtonChange(string buttonName, bool isPressed)
8785
/// <summary>
8886
/// Event that is raised when a button on the game controller is detected as being pressed or released.
8987
/// </summary>
90-
public event EventHandler<GameControllerButtonChangedEventArgs> ButtonChanged
91-
{
92-
add => weakEventManager.AddEventHandler(value);
93-
remove => weakEventManager.RemoveEventHandler(value);
94-
}
95-
88+
public event EventHandler<GameControllerButtonChangedEventArgs>? ButtonChanged;
89+
9690
/// <summary>
9791
/// Event that is raised when a button that supports a varying value on the game controller is detected as being pressed or released to some degree.
9892
/// </summary>
99-
public event EventHandler<GameControllerValueChangedEventArgs> ValueChanged
100-
{
101-
add => weakEventManager.AddEventHandler(value);
102-
remove => weakEventManager.RemoveEventHandler(value);
103-
}
93+
public event EventHandler<GameControllerValueChangedEventArgs>? ValueChanged;
10494

10595
internal void RaiseButtonValueChanged(ButtonValue buttonValue)
10696
{
10797
switch (buttonValue)
10898
{
10999
case ButtonValue<float> floatValue:
110-
weakEventManager.HandleEvent(this, new GameControllerValueChangedEventArgs(buttonValue.Name, floatValue.Value), nameof(ValueChanged));
100+
ValueChanged?.Invoke(this, new GameControllerValueChangedEventArgs(buttonValue.Name, floatValue.Value));
111101
break;
112102
case ButtonValue<bool> boolValue:
113-
weakEventManager.HandleEvent(this, new GameControllerButtonChangedEventArgs(buttonValue.Name, boolValue.Value), nameof(ButtonChanged));
103+
ButtonChanged?.Invoke(this, new GameControllerButtonChangedEventArgs(buttonValue.Name, boolValue.Value));
114104
break;
115105
}
116106
}

engine/Orbit.Input/Platforms/MacCatalyst/GameController.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ public GameController(GCController controller)
3535
}
3636
}
3737

38-
private void ValueDidChangeHandler(GCPhysicalInputProfile arg1, GCControllerElement arg2)
39-
{
40-
Changed(arg1, arg2);
41-
}
42-
4338
private void Changed(GCPhysicalInputProfile gamepad, GCControllerElement element)
4439
{
4540
Debug.WriteLine($"{element}");

0 commit comments

Comments
 (0)