carb::input::InputProvider

Defined in carb/input/InputProvider.h

struct InputProvider

Defines an input provider interface.

This interface is meant to be used only by the input providers. Hence it is in the separate file. The examples of input providers could be windowing system or network input stream.

Public Members

Keyboard *(*createKeyboard)(const char *name)

Create a logical keyboard.

Param name

Logical keyboard name.

Return

The keyboard created.

void (*destroyKeyboard)(Keyboard *keyboard)

Destroys the keyboard.

This function will wait to return until all references to keyboard are released.

Param keyboard

The logical keyboard.

void (*updateKeyboard)(Keyboard *keyboard)

Input “tick” for specific keyboard.

Is meant to be called in the beginning of a new frame, right before sending events. It saves old device state, allowing to differentiate pressed and released state of the buttons.

See also

ButtonFlags.

Param keyboard

Logical keyboard to update.

void (*bufferKeyboardEvent)(const KeyboardEvent &evt)

Sends keyboard event.

Param evt

Keyboard event.

Mouse *(*createMouse)(const char *name)

Create a logical mouse.

Param name

Logical mouse name.

Return

The mouse created.

void (*destroyMouse)(Mouse *mouse)

Destroys the mouse.

This function will wait to return until all references to mouse are released.

Param mouse

The logical mouse.

void (*updateMouse)(Mouse *mouse)

Input “tick” for specific mouse.

Is meant to be called in the beginning of a new frame, right before sending events. It saves old device state, allowing to differentiate pressed and released state of the buttons.

See also

ButtonFlags.

Param mouse

Logical mouse to update.

void (*bufferMouseEvent)(const MouseEvent &evt)

Sends mouse event.

Param evt

Mouse event.

Gamepad *(*createGamepad)(const char *name, const char *guid)

Create a logical gamepad.

Param name

Logical gamepad name.

Param guid

Device GUID.

Return

The gamepad created.

void (*setGamepadConnected)(Gamepad *gamepad, bool connected)

Broadcasts a gamepad connected event to all subscribers.

Subscribers are registered with IInput::subscribeToGamepadConnectionEvents().

Param gamepad

The logical gamepad.

Param connected

Is the gamepad connected?.

void (*destroyGamepad)(Gamepad *gamepad)

Destroys the gamepad.

This function will wait to return until all references to gamepad are released.

Param gamepad

The logical gamepad.

void (*updateGamepad)(Gamepad *gamepad)

Input “tick” for specific gamepad.

Is meant to be called in the beginning of a new frame, right before sending events. It saves old device state, allowing to differentiate pressed and released state of the buttons.

See also

ButtonFlags.

Param gamepad

Logical gamepad to update.

void (*bufferGamepadEvent)(const GamepadEvent &evt)

Send gamepad event.

Param evt

Mouse event.

void (*bufferInputEvent)(const InputEvent &evt)

Sends unified input event.

Param evt

A reference to unified input event description.