How simgine/bevy_enhanced_input works
Bevy Enhanced Input maps device bindings onto typed game actions, evaluates them within prioritized contexts, and exposes action values and lifecycle events to game logic. The main runtime path is input reading, binding/action configuration, condition and modifier evaluation, then action state and events. Presets and mock inputs provide distinct configuration and alternate-input capabilities. The graph uses the README and provided excerpts plus SOURCE INDEX references; unsampled implementation details are represented only where their paths and responsibilities are supported, and uncertain links are omitted.
Main entry points: context.rs Input Contexts · binding.rs Input Bindings · action.rs Typed Actions · condition.rs Trigger Conditions
Components 16
Action Setup
- Input Contexts
src/context.rs - Typed Actions
src/action.rs - Input Bindings
src/binding.rs - Binding Presets
src/preset.rs
Input Evaluation
- Device Input Reader
src/context/input_reader.rs - Mock Actions
src/action/mock.rs - Trigger State
src/state.rs
Input Customization
- Trigger Conditions
src/condition.rs - Combo Triggers
src/condition/combo.rs - Timed Triggers
src/condition/pulse.rs - Value Modifiers
src/modifier.rs - Axis Swizzling
src/modifier/swizzle_axis.rs
Action Results
- Action Events
src/action/events.rs
Other components
- Player Input
- Bevy App
- Game Logic
Connections 17
- Player Input → Device Input Reader: provides input
src/context/input_reader.rs - Bevy App → Input Contexts: hosts
- Input Contexts → Device Input Reader: reads inputs
src/context.rs - Input Contexts → Typed Actions: evaluates actions
src/context.rs - Input Contexts → Input Bindings: evaluates bindings
src/context.rs - Input Bindings → Trigger Conditions: configures triggers
src/binding.rs - Input Bindings → Value Modifiers: configures transforms
src/binding.rs - Binding Presets → Input Bindings: builds bindings
src/preset.rs - Binding Presets → Axis Swizzling: uses modifier
src/preset.rs - Input Contexts → Mock Actions: applies mock
src/context.rs - Trigger Conditions → Combo Triggers: includes pattern
src/condition.rs - Trigger Conditions → Timed Triggers: includes timing
src/condition.rs - Value Modifiers → Axis Swizzling: includes transform
src/modifier.rs - Typed Actions → Action Events: defines events
src/action.rs - Input Contexts → Trigger State: updates state
src/context.rs - Action Events → Game Logic: notifies
src/action/events.rs - Typed Actions → Game Logic: exposes values