nCine::Backends::SdlInputManager class

SDL2-based input manager.

Parses and dispatches SDL2 input events for keyboard, mouse, touch and joysticks.

Base classes

class nCine::IInputManager
Interface for querying input state and dispatching input events.

Public static functions

static auto shouldQuitOnRequest() -> bool
Returns true if the application should quit in response to a quit request.
static void parseEvent(const SDL_Event& event)
Parses a single SDL2 event and dispatches it to the registered input handler.

Constructors, destructors, conversion operators

SdlInputManager()
The constructor takes care of opening available joysticks.
~SdlInputManager()
The destructor releases every opened joystick.

Public functions

auto mouseState() const -> const MouseState& override
Returns the current mouse state.
auto keyboardState() const -> const KeyboardState& override
Returns the current keyboard state.
auto getClipboardText() const -> String override
Returns the clipboard text, or empty if none.
auto setClipboardText(StringView text) -> bool override
Sets the clipboard text.
auto getKeyName(Keys key) const -> StringView override
Returns the display name of the specified key.
auto isJoyPresent(int joyId) const -> bool override
Returns true if the specified joystick is connected.
auto joyName(int joyId) const -> const char* override
Returns the name of the specified joystick.
auto joyGuid(int joyId) const -> const JoystickGuid override
Returns the GUID of the specified joystick.
auto joyNumButtons(int joyId) const -> int override
Returns the number of buttons of the specified joystick.
auto joyNumHats(int joyId) const -> int override
Returns the number of hats of the specified joystick.
auto joyNumAxes(int joyId) const -> int override
Returns the number of axes of the specified joystick.
auto joystickState(int joyId) const -> const JoystickState& override
Returns the raw state of the specified joystick.
auto joystickRumble(int joyId, float lowFreqIntensity, float highFreqIntensity, uint32_t durationMs) -> bool override
Starts a low/high frequency rumble effect for the specified duration in milliseconds.
auto joystickRumbleTriggers(int joyId, float left, float right, uint32_t durationMs) -> bool override
Starts a left/right trigger rumble effect for the specified duration in milliseconds.
void setCursor(Cursor cursor) override
Sets the mouse cursor mode.

Function documentation

static void nCine::Backends::SdlInputManager::parseEvent(const SDL_Event& event)

Parses a single SDL2 event and dispatches it to the registered input handler.

Parameters
event SDL2 event to process