diff --git a/src/Input/Input.cs b/src/Input/Input.cs
index d2ea27e..4700d2c 100644
--- a/src/Input/Input.cs
+++ b/src/Input/Input.cs
@@ -35,6 +35,22 @@ namespace MoonWorks.Input
///
public VirtualButton AnyPressedButton { get; private set; }
+ public delegate void OnGamepadConnectedFunc(int slot);
+
+ ///
+ /// Called when a gamepad has been connected.
+ ///
+ /// The slot where the connection occurred.
+ public OnGamepadConnectedFunc OnGamepadConnected;
+
+ public delegate void OnGamepadDisconnectedFunc(int slot);
+
+ ///
+ /// Called when a gamepad has been disconnected.
+ ///
+ /// The slot where the disconnection occurred.
+ public OnGamepadDisconnectedFunc OnGamepadDisconnected;
+
internal Inputs()
{
Keyboard = new Keyboard();
@@ -126,7 +142,9 @@ namespace MoonWorks.Input
{
Gamepads[slot].Register(openResult);
Logger.LogInfo($"Gamepad added to slot {slot}!");
+ OnGamepadConnected(slot);
}
+
return;
}
}
@@ -143,6 +161,7 @@ namespace MoonWorks.Input
SDL.SDL_GameControllerClose(Gamepads[slot].Handle);
Gamepads[slot].Unregister();
Logger.LogInfo($"Removing gamepad from slot {slot}!");
+ OnGamepadDisconnected(slot);
return;
}
}