carb::input::getDeviceInputFromString

Defined in carb/input/InputUtils.h

inline bool carb::input::getDeviceInputFromString(const char *deviceInputString, DeviceType *deviceTypeOut, KeyboardInput *keyboardInputOut, MouseInput *mouseInputOut, GamepadInput *gamepadInputOut, std::string *deviceIdOut = nullptr)

Parses components from a device input string.

Note

Only one of keyboardInputOut, mouseInputOut or gamepadInputOut will be filled based on the DeviceType.

Parameters
  • deviceInputString – A device input string.

  • deviceTypeOut – The DeviceType. If nullptr, parsing fails and false is returned.

  • keyboardInputOut – (optional) Receives any KeyboardInput parsed from deviceInputString.

  • mouseInputOut – (optional) Receives any MouseInput parsed from deviceInputString.

  • gamepadInputOut – (optional) Receives any GamepadInput parsed from deviceInputString.

  • deviceIdOut – (optional) Receives the device identifier as per parseDeviceNameString().

Returns

true if parsing was successful; false if an error occurred.