Crate bevy_actify

Source
Expand description

SPDX-License-Identifier: MIT OR Apache-2.0

A flexible and ergonomic input action system for Bevy.

This library provides a structured way to handle input actions in Bevy, allowing you to define abstract input actions that can be mapped from various input sources (keyboard, mouse, gamepad, etc.) and consumed by game systems in a consistent way.

§Features

  • Input Action Abstraction: Define abstract input actions separate from concrete inputs
  • State Management: Track whether actions are active/idle and their current values
  • Event-like System: React to action starts, updates, and stops
  • Multi-source Input: Combine inputs from multiple sources into a single action state
  • Conditional Systems: Feature-gated helpers for common input conditions

§Core Concepts

  • InputAction: A trait representing an abstract input action
  • InputActionState: Read the current state of an action
  • InputActionDrain: Write action state from input systems
  • InputActionReader: React to changes in action state

§Basic Usage

  1. Define your input action type (must implement InputAction)
  2. Add the input action using InputActionAppExt::add_input_action
  3. Write input systems that pour values into the InputActionDrain
  4. Read the action state using InputActionState (or InputActionReader for status updates)

§System Ordering

  • Systems that write to InputActionDrain should run before InputActionSystem
  • Systems that read from InputActionState typically run in Update (after PreUpdate)

Re-exports§

pub use conditions::input_action_active;conditions
pub use conditions::input_action_started;conditions
pub use conditions::input_action_stopped;conditions
pub use conditions::input_action_updated;conditions

Modules§

conditionsconditions
SPDX-License-Identifier: MIT OR Apache-2.0
prelude
This module re-exports all necessary things to work with an input action.

Structs§

InputActionDrain
Provides write access to the input action drain.
InputActionReader
Reader for input action status updates.
InputActionState
Provides read-only access to the current state of an input action.
InputActionSystem
Label for systems that update input actions.

Enums§

InputActionStatus
Represents the status of an input action as read from an InputActionReader.

Traits§

InputAction
Marker trait for all input actions.
InputActionAppExt
Extension trait for App and SubApp.

Derive Macros§

InputActionderive
Derive macro implementation for InputAction trait