bevy-input-handling
Installation
SKILL.md
Bevy input handling
When to use
Load this when a system should read keyboard, mouse, or gamepad state. The bevy::input module (docs.rs latest, crate 0.20.0) is the source for the names below.
ECS shape
- Plugin:
InputPluginadds input from keyboard, mouse, gamepad, and touch. It ships inside the usual app plugins.InputSystemslabels the systems that refresh that data. - Keyboard resource:
Res<ButtonInput<KeyCode>>.KeyCodeis the physical key (layout-stable).Res<ButtonInput<Key>>is the logical key. The keyboard example usespressed,just_pressed, andjust_released. - Mouse:
mouse_button_input_systemwritesButtonInput<MouseButton>fromMouseButtonInput.AccumulatedMouseMotionandAccumulatedMouseScrollare resources reset every frame.MouseMotionandMouseWheelare the underlying events. - Gamepad:
Gamepadstores a connected pad's metadata (GamepadButton,GamepadAxis). Connection and axis changes arrive asGamepadConnectionEvent,GamepadAxisChangedEvent, andGamepadButtonChangedEvent.GamepadRumbleRequestis the force-feedback event. - Schedule: read these resources from a system on
Update(or a schedule you already chain). Do not invent an input-map resource.