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.
Audience: game code.
#include "engine/input/scripted_gamepad_source.h" · namespace labrador
enum class ScriptedGamepadEvent
Section titled “enum class ScriptedGamepadEvent”{ sample, suspend, resume, vibrate, stop,};struct ScriptedGamepadRecord
Section titled “struct ScriptedGamepadRecord”int slot = -1;vibration
Section titled “vibration”accepted
Section titled “accepted”bool accepted = false;seconds
Section titled “seconds”double seconds = 0.0;class ScriptedGamepadSource
Section titled “class ScriptedGamepadSource”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”~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 · operator=
Section titled “ScriptedGamepadSource · operator=”ScriptedGamepadSource& operator=(const ScriptedGamepadSource&) = delete;ScriptedGamepadSource(ScriptedGamepadSource&&) = delete;ScriptedGamepadSource& operator=(ScriptedGamepadSource&&) = delete;set_state
Section titled “set_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.
set_vibration_available
Section titled “set_vibration_available”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.
set_time
Section titled “set_time”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”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.
Related types
Section titled “Related types”Named in the public declarations above: GamepadReader, GamepadState, Vibration.
In the samples and tests
Section titled “In the samples and tests”The files that include this header directly. A file can also reach it through another header.
samples/components/gallery_binding_tests.cpp,gallery_touch_tests.cpptests/app/application_options_tests.cpp,application_scripted_pad_tests.cpptests/input/scripted_gamepad_source_tests.cpptests/input/web/scripted_no_api_tests.cpp
Explained in
Section titled “Explained in”Development documentation (unreleased). Built from Labrador aceb130 of 2026-11-20.