API Reference

To make it easier to work with Switcheroo, the C++ API and the Blueprint API are largely the same. The plugin API is designed to be simple to use and self-explanatory.


Blueprint API

All the available Blueprint nodes are listed below, alongside Switcheroo types and a couple of utility functions. These are used internally by the plugin, but can also be useful in some cases (e.g. if you want to apply the same dead zone used by the plugin to your game input). Documentation for each node is available by hovering it inside the editor.


C++ API

All the methods live inside the ISwitcherooModule class, and can be called on the Switcheroo module instance (see the usage section for additional information). Documentation is available directly in the code for all methods and types.

class SWITCHEROO_API ISwitcherooModule : public IModuleInterface
{
 
    // [...]
 
public:
 
    /** Gets whether the detection of the input device is enabled or disabled. */
    virtual bool IsInputDetectionEnabled() const = 0;
 
    /** Enables detection of the input device. */
    virtual void EnableInputDetection() = 0;
 
    /** Disables detection of the input device. */
    virtual void DisableInputDetection() = 0;
 
    /** Enables or disables detection of the input device. */
    virtual void SetInputDetectionEnabled(const bool bEnabled) = 0;
 
    /**
        * Gets the detected input device.
        * @returns The active input device if one has been detected; otherwise, the default input device specified in project settings.
        */
    virtual ESwitcherooInputDevice GetDetectedInputDevice() const = 0;
 
    /** Event fired when the detected input device changes. */
    DECLARE_EVENT_OneParam(ISwitcherooModule, FSwitcherooInputDeviceChangedEvent, ESwitcherooInputDevice /* ActiveInputDevice */);
    virtual FSwitcherooInputDeviceChangedEvent& OnDetectedInputDeviceChanged() = 0;
 
    // [...]
 
};

Settings can be accessed using the USwitcherooSettings default object:

// Get the "Default Input Device" option
const ESwitcherooInputDevice DefaultDevice = GetDefault<USwitcherooSettings>()->GetDefaultInputDevice();
 
// Set the "Default Input Device" option
GetMutableDefault<USwitcherooSettings>()->SetDefaultInputDevice(ESwitcherooInputDevice::KeyboardMouse);