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.
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.
| Field | Type | Description |
|---|---|---|
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.
| Field | Type | Description |
|---|---|---|
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() -> boolAttaches 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() -> boolAttaches the Android adapter.
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) -> voidApplies event-tuning knobs. Safe to call before or after Start().
| Parameter | Type | Description |
|---|---|---|
t |
const Tuning& |
Tuning values to apply. |
auto Start() -> boolStarts 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() -> voidStops the adapter and halts event delivery.
auto OnInput(std::function<void(const InputEvent&)> cb) -> voidRegisters a callback for normalized input events.
| Parameter | Type | Description |
|---|---|---|
cb |
std::function<void(const InputEvent&)> |
Callback invoked with each input event snapshot. |
auto OnDeviceChange(std::function<void(const DeviceConnectionEvent&)> cb) -> voidRegisters a callback for device connect and disconnect notifications.
| Parameter | Type | Description |
|---|---|---|
cb |
std::function<void(const DeviceConnectionEvent&)> |
Callback invoked with each connection state change. |
auto SetVelocityLimits(const VelocityLimits& l) -> voidSets the per-axis velocity limits applied by the bridge.
| Parameter | Type | Description |
|---|---|---|
l |
const VelocityLimits& |
New velocity limits. |
auto SetVelocitySensitivity(float movement, float rotation) -> voidSets 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.
| Parameter | Type | Description |
|---|---|---|
movement |
float |
Scale factor for translational axes (0–1). |
rotation |
float |
Scale factor for the yaw rate axis (0–1). |
auto PauseVelocity() -> voidTemporarily suspends velocity output without unregistering the input subscription.
auto ResumeVelocity() -> voidResumes velocity output after a call to PauseVelocity().