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: InputPlugin adds input from keyboard, mouse, gamepad, and touch. It ships inside the usual app plugins. InputSystems labels the systems that refresh that data.
  • Keyboard resource: Res<ButtonInput<KeyCode>>. KeyCode is the physical key (layout-stable). Res<ButtonInput<Key>> is the logical key. The keyboard example uses pressed, just_pressed, and just_released.
  • Mouse: mouse_button_input_system writes ButtonInput<MouseButton> from MouseButtonInput. AccumulatedMouseMotion and AccumulatedMouseScroll are resources reset every frame. MouseMotion and MouseWheel are the underlying events.
  • Gamepad: Gamepad stores a connected pad's metadata (GamepadButton, GamepadAxis). Connection and axis changes arrive as GamepadConnectionEvent, GamepadAxisChangedEvent, and GamepadButtonChangedEvent. GamepadRumbleRequest is 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.

Coming from Godot

Installs
4
GitHub Stars
850
First Seen
3 days ago