Hi,
Unfortunately, there is no such function. But code you need lay in XInputInterface.cpp
/** Controller states */
FControllerState ControllerStates[MAX_NUM_XINPUT_CONTROLLERS];
This variable is private and XInputInterface has no function to get it. I think the simple way to access to that variable it is add interface that check gamepad.
GenericApplication.h
virtual bool IsGamepadConnected() { return false; }
WindowsApplication.h
virtual bool IsGamepadConnected() override;
WindowsApplication.cpp
bool FWindowsApplication::IsGamepadConnected()
{
return XInput->IsGamepadConnected();
}
XInputInterface.h
bool IsGamepadConnected();
XInputInterface.cpp
bool XInputInterface::IsGamepadConnected()
{
for (int32 ControllerIndex = 0; ControllerIndex < MAX_NUM_XINPUT_CONTROLLERS; ++ControllerIndex)
{
FControllerState& ControllerState = ControllerStates[ControllerIndex];
if (ControllerState.bIsConnected)
return true;
}
return false;
}
And call that where you need
TSharedPtr<GenericApplication> GenericApplication = SlateApplication::Get().GetPlatformApplication();
GenericApplication->IsGamepadConnected();
In addition, I think it is not very good idea to do that, because we add very specific functions to general functionality. But I hope it will be a start point for solving your problem.
Cheers