parent
352bb34f82
commit
6c93350f7f
|
@ -35,6 +35,22 @@ namespace MoonWorks.Input
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VirtualButton AnyPressedButton { get; private set; }
|
public VirtualButton AnyPressedButton { get; private set; }
|
||||||
|
|
||||||
|
public delegate void OnGamepadConnectedFunc(int slot);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when a gamepad has been connected.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="slot">The slot where the connection occurred.</param>
|
||||||
|
public OnGamepadConnectedFunc OnGamepadConnected;
|
||||||
|
|
||||||
|
public delegate void OnGamepadDisconnectedFunc(int slot);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when a gamepad has been disconnected.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="slot">The slot where the disconnection occurred.</param>
|
||||||
|
public OnGamepadDisconnectedFunc OnGamepadDisconnected;
|
||||||
|
|
||||||
internal Inputs()
|
internal Inputs()
|
||||||
{
|
{
|
||||||
Keyboard = new Keyboard();
|
Keyboard = new Keyboard();
|
||||||
|
@ -126,7 +142,9 @@ namespace MoonWorks.Input
|
||||||
{
|
{
|
||||||
Gamepads[slot].Register(openResult);
|
Gamepads[slot].Register(openResult);
|
||||||
Logger.LogInfo($"Gamepad added to slot {slot}!");
|
Logger.LogInfo($"Gamepad added to slot {slot}!");
|
||||||
|
OnGamepadConnected(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,6 +161,7 @@ namespace MoonWorks.Input
|
||||||
SDL.SDL_GameControllerClose(Gamepads[slot].Handle);
|
SDL.SDL_GameControllerClose(Gamepads[slot].Handle);
|
||||||
Gamepads[slot].Unregister();
|
Gamepads[slot].Unregister();
|
||||||
Logger.LogInfo($"Removing gamepad from slot {slot}!");
|
Logger.LogInfo($"Removing gamepad from slot {slot}!");
|
||||||
|
OnGamepadDisconnected(slot);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue