In my game players could play via controllers and a keyboard.
When player is disconnected I would like to pause the game. I can easily detect controller disconnection event via the JoyConnectionChanged
event
public override void _Ready()
{
Input.JoyConnectionChanged += JoyConnectionChanged;
}
private void JoyConnectionChanged(long device, bool connected)
{
GD.Print("Device " + device + " is connected? " + connected);
}
Is there a similar way to determine if a keyboard got disconnected?