input#

Fully qualified name: carb::input

namespace input#

Namespace for the carb.input plugin.

Namespace for Carbonite Input system.

Classes#

ActionMappingSet

A type representing a set of action mappings.

ScopedRead

A RAII class for holding a read lock over multiple operations.

ScopedWrite

A RAII class for holding a write lock over multiple operations.

Enumerations#

CurrentButtonState

Current button state.

DeviceType

Defines possible device types.

uint8_t FilterResult

The result returned by InputEventFilterFn.

GamepadConnectionEventType

Defines the gamepad connection event types.

InputType GamepadInput

Defines a gamepad input.

KeyboardEventType

Defines keyboard event type.

InputType KeyboardInput

Defines keyboard key codes.

MouseEventType

Defines the mouse event types.

InputType MouseInput

Defines a mouse input.

PreviousButtonState

Previous button state.

Functions#

void filterBufferedEvents(IInput *input, Callable &&callable)

Filter and modify input events in the event buffer.

ActionMappingDesc getActionMappingDescFromString(const char *hotkeyString, std::string *deviceId)

Translates a hot-key string to a ActionMappingDesc .

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

Parses components from a device input string.

std::string getDeviceNameString(DeviceType deviceType, const char *deviceId)

Returns a device name.

DeviceType getDeviceTypeFromString(const char *deviceTypeString)

Converts a device-type string to a DeviceType .

const char * getDeviceTypeString(DeviceType deviceType)

Returns a string representation of the device type.

GamepadInput getGamepadInputFromString(const char *inputString)

Converts a gamepad input string to a GamepadInput .

const char * getGamepadInputString(GamepadInput key)

Returns a string representation of a gamepad input enum value.

KeyboardInput getKeyboardInputFromString(const char *inputString)

Converts a keyboard input string to a KeyboardInput .

const char * getKeyboardInputString(KeyboardInput key)

Returns a string representation of the keyboard input.

KeyboardModifierFlags getModifierFlagFromString(const char *inputString)

Converts a keyboard modifier flag string to a KeyboardModifierFlags .

const char * getModifierFlagString(KeyboardModifierFlags flag)

Returns a string representation of the keyboard modifier flag.

KeyboardModifierFlags getModifierFlagsFromString(const char *modString)

Returns KeyboardModifierFlags composed of all the flags from a given string.

std::string getModifierFlagsString(KeyboardModifierFlags mod)

Returns a string of all modifier flags present.

MouseInput getMouseInputFromString(const char *inputString)

Converts a mouse input string to a MouseInput .

const char * getMouseInputString(MouseInput key)

Returns a string representation of a mouse input enum value.

std::string getStringFromActionMappingDesc(const ActionMappingDesc &actionMappingDesc, const char *deviceName=nullptr)

Builds a hot-key string from a ActionMappingDesc .

void parseDeviceNameString(const char *deviceName, DeviceType *deviceType, std::string *deviceId)

Separates a device name into a device type and device ID.

bool setDefaultActionMapping(IInput *input, ActionMappingSetHandle actionMappingSet, const char *actionName, const ActionMappingDesc &desc)

Adds an action mapping if one does not already exist.

SubscriptionId subscribeToActionEvents(IInput *input, ActionMappingSetHandle actionMappingSet, const char *actionName, Functor &&functor)

Subscribes to the action event stream for a specified action.

SubscriptionId subscribeToGamepadConnectionEvents(IInput *input, Functor &&functor)

Subscribes to the gamepad connection event stream.

SubscriptionId subscribeToGamepadEvents(IInput *input, Gamepad *gamepad, Functor &&functor)

Subscribes to the gamepad event stream.

SubscriptionId subscribeToKeyboardEvents(IInput *input, Keyboard *keyboard, Functor &&functor)

Subscribes to the keyboard event stream.

SubscriptionId subscribeToMouseEvents(IInput *input, Mouse *mouse, Functor &&functor)

Subscribes to the mouse event stream.

ButtonFlags toButtonFlags(PreviousButtonState previousButtonState, CurrentButtonState currentButtonState)

Combines the previous and current button states into a Button flags. .

CurrentButtonState toCurrentButtonState(bool isDown)

Converts a button state to a CurrentButtonState .

PreviousButtonState toPreviousButtonState(bool wasDown)

Converts a button state to a PreviousButtonState .

Structs#

ActionEvent

Defines an action event.

ActionMappingDesc

Defines action mapping description.

Gamepad

An opaque type representing a Gamepad .

GamepadConnectionEvent

Defines the gamepad connection event.

GamepadEvent

Defines a gamepad event.

IInput

Defines an input interface.

InputDevice

An opaque type representing an Input Device.

InputEvent

Defines the unified input event.

InputProvider

Defines an input provider interface.

Keyboard

An opaque type representing a Keyboard .

KeyboardEvent

Defines a keyboard event.

Mouse

An opaque type representing a Mouse .

MouseEvent

Defines the mouse event.

Typedefs#

ActionMappingSetHandle

A handle to an ActionMappingSet . A nullptr value represents an invalid ActionMappingSet .

ButtonFlags

Type definition representing button flags.

EventTypeMask

Defines event type mask.

InputEventFilterFn

Callback function type for filtering events.

InputType

Defines input code type.

KeyboardModifierFlags

Type definition representing keyboard modifier flags.

OnActionEventFn

Function type that describes keyboard event callback.

OnGamepadConnectionEventFn

Function type that describes gamepad connection event callback.

OnGamepadEventFn

Function type that describes gamepad event callback.

OnInputEventFn

Function type that describes input event callback.

OnKeyboardEventFn

Function type that describes keyboard event callback.

OnMouseEventFn

Function type that describes mouse event callback.

SubscriptionId

Type used as an identifier for all subscriptions.

SubscriptionOrder

Subscription order.

Variables#

const char *const kAnyDevice

A value that means any available device.

const uint32_t kButtonFlagStateDown

Button is down.

const uint32_t kButtonFlagStateUp

Button is up.

const uint32_t kButtonFlagTransitionDown

Button is transitioning from up to down.

const uint32_t kButtonFlagTransitionUp

Button is transitioning from down to up.

const uint32_t kCharacterMaxNumBytes

UTF-8 RFC3629 - max 4 bytes per character.

constexpr char kDeviceNameSeparator

The separator used for device name components.

constexpr EventTypeMask kEventTypeAll

Represents all event types.

constexpr SubscriptionId kInvalidSubscriptionId

An invalid SubscriptionId with value 0.

const uint32_t kKeyboardModifierFlagAlt

Alt key.

const uint32_t kKeyboardModifierFlagCapsLock

Caps-lock key.

const uint32_t kKeyboardModifierFlagControl

Control key.

const uint32_t kKeyboardModifierFlagCount

Defines total number of keyboard modifiers.

const uint32_t kKeyboardModifierFlagNumLock

Num-lock key.

const uint32_t kKeyboardModifierFlagShift

Shift key.

const uint32_t kKeyboardModifierFlagSuper

Super key.

constexpr char kModifierSeparator

The separator used for modifiers.

constexpr SubscriptionOrder kSubscriptionOrderDefault

The 'default' subscription ordering, same as kSubscriptionOrderLast .

constexpr SubscriptionOrder kSubscriptionOrderFirst

Represents the 'first' subscription.

constexpr SubscriptionOrder kSubscriptionOrderLast

Represents the 'last' subscription.