bevyengine/bevy
bevy_gilrs
Gamepad input via the gilrs crate. Translates gilrs events into Bevy's GamepadConnectionEvent, GamepadButtonChangedEvent, and GamepadAxisChangedEvent.
Purpose
bevy_input defines the gamepad component types and resource API; bevy_gilrs is the platform backend that actually polls gilrs and updates the component state. On platforms or builds where gilrs isn't available you can use bevy_input without this plugin and route gamepad data from your own backend.
Directory layout
crates/bevy_gilrs/src/
├── lib.rs # GilrsPlugin
├── gilrs_system.rs # Per-frame poll system
├── converter.rs # gilrs → bevy event/axis conversion
└── rumble.rs # Force-feedback rumbleKey abstractions
| Type | File | Description |
|---|---|---|
GilrsPlugin |
crates/bevy_gilrs/src/lib.rs |
Initializes gilrs::Gilrs and adds the polling system. |
Gilrs (resource) |
crates/bevy_gilrs/src/lib.rs |
Wraps the gilrs::Gilrs instance. |
How it works
Each frame in PreUpdate, gilrs_event_system drains pending events from the gilrs::Gilrs event queue and translates them into Bevy events. Connection events spawn or despawn Gamepad entities; button and axis events update the corresponding component state on those entities.
Rumble is the inverse path: a system reads GamepadRumbleRequest events, schedules effects through gilrs::ff, and clears them when complete.
Integration points
- Depends on:
gilrs,bevy_app,bevy_ecs,bevy_input,bevy_time. - Depended on by:
bevy_internal(default plugins, whenbevy_gilrsfeature is on).
Entry points for modification
- Adding new event types: edit
converter.rsand the correspondingbevy_inputevents. - Custom rumble curves:
rumble.rs.
See also
bevy_input— defines the events and components this plugin populates.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.