Skip to content

ScriptedGamepadSource

Generated from engine/input/scripted_gamepad_source.h at aceb130. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.

Browse the input module

Audience: game code.

#include "engine/input/scripted_gamepad_source.h" · namespace labrador

{
sample,
suspend,
resume,
vibrate,
stop,
};
ScriptedGamepadEvent event = ScriptedGamepadEvent::sample;
int slot = -1;
Vibration vibration;
bool accepted = false;
double seconds = 0.0;

An explicitly selected pad source for fixtures in the shipping library. Owns copies of supplied snapshots and records; never calls a pad API. Use on one thread. This immovable object must outlive its borrowing reader (and Application, when selected there), including reader moves and teardown. Only one reader may borrow a source at a time; distinct sources are isolated.

ScriptedGamepadSource · ~ScriptedGamepadSource

Section titled “ScriptedGamepadSource · ~ScriptedGamepadSource”
explicit ScriptedGamepadSource(std::size_t record_capacity = 1024);
~ScriptedGamepadSource();

Reserves a bounded record buffer once. A full buffer drops later records and sets records_overflowed(); input and vibration lifetimes still run. Recording never allocates during sampling, suspension or teardown.

ScriptedGamepadSource(const ScriptedGamepadSource&) = delete;
ScriptedGamepadSource& operator=(const ScriptedGamepadSource&) = delete;
ScriptedGamepadSource(ScriptedGamepadSource&&) = delete;
ScriptedGamepadSource& operator=(ScriptedGamepadSource&&) = delete;
void set_state(int slot, const GamepadState& state);

Copies the next sample's state. Slots are [0, 4); other values throw std::out_of_range. Disconnected snapshots are made wholly neutral. To replace a pad, sample its disconnection before reusing its slot.

void set_vibration_available(int slot, bool available);

Choose whether this slot's simulated output accepts a request; true initially. Disconnected and suspended slots always refuse output.

void set_time(double seconds);

Seconds on the script's clock, initially zero. Must be finite and nonnegative and never decrease; invalid values throw invalid_argument. Expiry is checked on sample(), as it is for the configured source.

records · records_overflowed · clear_records

Section titled “records · records_overflowed · clear_records”
std::span<const ScriptedGamepadRecord> records() const;
bool records_overflowed() const;
void clear_records();

Borrowed until clear_records() or destruction. Appending does not invalidate existing records. Clear resets the overflow flag too.

Named in the public declarations above: GamepadReader, GamepadState, Vibration.

The files that include this header directly. A file can also reach it through another header.

Development documentation (unreleased). Built from Labrador aceb130 of 2026-11-20.

All documentation versions