InputEvent

Public data types delivered to InputController callbacks.

#include <input_event.hpp>

Structs

struct ButtonMask

Compact bitmask representing the pressed state of all gamepad buttons.

FieldTypeDescription
bits uint32_t One bit per GamepadButton ordinal

struct StickAxes

Normalized analog stick and trigger axis snapshot, before deadzone and curve are applied.

Sign convention: lx/rx — left = -1, right = +1. ly/ry — up = -1, down = +1 (screen coordinates). l2/r2 — released = 0, fully pressed = +1.

FieldTypeDescription
lx float Left stick horizontal axis
ly float Left stick vertical axis
rx float Right stick horizontal axis
ry float Right stick vertical axis
l2 float Left trigger (0–1)
r2 float Right trigger (0–1)

struct GamepadBattery

Gamepad battery status reported by the device.

FieldTypeDescription
valid bool true if the device reported battery data
percent int 0–100, or -1 if unknown
charging bool true if the device is currently charging

struct InputEvent

Full gamepad state snapshot delivered on each input event.

Carries complete current state rather than deltas so subscribers remain stateless and are safe against dropped events.

FieldTypeDescription
device_id DeviceId Originating device identifier
timestamp_us uint64_t Event timestamp in microseconds
axes StickAxes Analog stick and trigger values
buttons ButtonMask Current button pressed state
battery GamepadBattery Battery status at the time of the event

struct DeviceConnectionEvent

Notification of a device connection or disconnection.

FieldTypeDescription
device_id DeviceId Affected device identifier
connected bool true if connected, false if disconnected
name std::string Vendor-supplied display name of the device
vendor_id uint16_t USB vendor ID
product_id uint16_t USB product ID

Enums

enum GamepadButton

Identifies a gamepad button by its logical role.

ValueDescription
South Cross / A
East Circle / B
West Square / X
North Triangle / Y
L1 Left shoulder button
R1 Right shoulder button
L3 Left stick click
R3 Right stick click
Select Select / Back button
Start Start / Menu button
Guide Guide / Home button
DpadUp D-pad up
DpadDown D-pad down
DpadLeft D-pad left
DpadRight D-pad right
Touchpad Touchpad click (where available)
Count Sentinel — number of defined buttons