InputController

High-level facade for gamepad input and velocity bridging.

#include <input_controller.hpp>

Classes

class ROGUE_SDK_API

Manages gamepad input delivery and optional stick-to-velocity bridging.

Note:

Input and connection callbacks fire on the adapter's thread — keep them short and non-blocking. The velocity setter is called from a separate timer thread, not the input thread.

struct Tuning

Tuning knobs applied to raw adapter events before subscribers receive them.

FieldTypeDescription
stick_deadzone float Deadzone radius applied to analog sticks (0–1)
trigger_deadzone float Deadzone threshold applied to triggers (0–1)
expo float Exponential curve factor applied to stick output (0–1)
invert_left_y bool Invert the left stick Y axis
invert_right_y bool Invert the right stick Y axis

struct VelocityLimits

Per-axis velocity limits used by the velocity bridge.

FieldTypeDescription
max_vx float m/s, forward/back
max_vy float m/s, strafe
max_vz float m/s, climb/descend
max_yaw_rate float rad/s, CCW = +
auto AttachDesktop() -> bool

Attaches the desktop adapter.

Call once before Start(). On platforms where the desktop adapter is unavailable this returns false and the controller operates with no input source; subscribers remain valid but will not receive events.

Returns: true if the adapter was registered successfully.

auto AttachAndroid() -> bool

Attaches the Android adapter.

Note:

JNI globals must be set via roguesdk::platform::android::AndroidContext::SetJvm and SetService before calling this method.

Returns: true if the adapter was registered successfully.

auto Configure(const Tuning& t) -> void

Applies event-tuning knobs. Safe to call before or after Start().

ParameterTypeDescription
t const Tuning& Tuning values to apply.
auto Start() -> bool

Starts the adapter and begins event delivery.

A missing or failed adapter is non-fatal — the controller remains usable without a physical device connected.

Returns: true if at least one adapter started successfully.

auto Stop() -> void

Stops the adapter and halts event delivery.

auto OnInput(std::function<void(const InputEvent&)> cb) -> void

Registers a callback for normalized input events.

ParameterTypeDescription
cb std::function<void(const InputEvent&)> Callback invoked with each input event snapshot.
auto OnDeviceChange(std::function<void(const DeviceConnectionEvent&)> cb) -> void

Registers a callback for device connect and disconnect notifications.

ParameterTypeDescription
cb std::function<void(const DeviceConnectionEvent&)> Callback invoked with each connection state change.
auto SetVelocityLimits(const VelocityLimits& l) -> void

Sets the per-axis velocity limits applied by the bridge.

ParameterTypeDescription
l const VelocityLimits& New velocity limits.
auto SetVelocitySensitivity(float movement, float rotation) -> void

Sets the sensitivity scale factors for movement and rotation axes.

Both factors are clamped to [0, 1]. The movement factor scales vx, vy, and vz; the rotation factor scales yaw_rate. Safe to call at interactive update rates.

ParameterTypeDescription
movement float Scale factor for translational axes (0–1).
rotation float Scale factor for the yaw rate axis (0–1).
auto PauseVelocity() -> void

Temporarily suspends velocity output without unregistering the input subscription.

auto ResumeVelocity() -> void

Resumes velocity output after a call to PauseVelocity().