A simple-to-use input manager for the Bevy game engine that empowers players and makes accessibility easy.

Overview

Crates.io Downloads Docs unsafe forbidden License

Bevy Ineffable

A simple-to-use input manager for the Bevy game engine that empowers players and makes accessibility easy.

Core tenets

  1. Make accessibility easy.
    • Players can create and share custom input configs. Configs can be merged at runtime.
    • Post acceptance delay helps players with conditions like Parkinson's avoid unintended key presses.
    • Toggling continuous input helps players who physically cannot hold down a button for long periods of time.
    • Macro support coming soon.
  2. Offer a unified, abstracted view of input.
    • Games should be agnostic of specific input devices.
    • No more manually gathering keyboard, mouse and gamepad input from multiple sources.
  3. Never allow the game to crash, but provide clear and direct feedback when something goes wrong.
    • Scans player-made keybinding configurations and composes a report containing detailed feedback.
  4. Recognise the existence of different kinds of input (axis, dual-axis, continuous and pulse), and leverage the type system to differentiate between them at compile time.
    • DualAxis: Inputs a direction along two axes. E.g. an analog stick.
    • SingleAxis: Inputs a direction along one axis. E.g. the mouse wheel.
    • Continuous: Is active continuously. E.g. while a button is held down.
    • Pulse: Pulses occasionally. E.g. clicking left mouse button.

Quickstart

[dependencies]
# Add bevy_ineffable as a dependency to your `Cargo.toml`
bevy_ineffable = "0.5.0"
use bevy::prelude::*;
use bevy_ineffable::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        // Always add the IneffablePlugin:
        .add_plugins(IneffablePlugin)
        // Also register GooseInput as an InputAction:
        .register_input_action::<GooseInput>()
        .add_systems(Startup, init)
        .add_systems(Update, update)
        .run();
}

/// Define an enum and derive `InputAction`.
/// These are the abstract actions that keys can be bound to.
#[derive(InputAction)]
pub enum GooseInput {
    /// In this example, the only thing the player can do is honk.
    /// We must define what kind of input Honk is. Honking is 
    /// enacted instantaneously, so we'll define it as a pulse.
    #[ineffable(pulse)]
    Honk,

    // You can add more actions here...

}

/// Create a config that binds the space bar to the `Honk` action.
fn init(mut ineffable: IneffableCommands) {
    // The builder pattern is used here, but configs can also 
    // be loaded as an asset.
    let config = InputConfig::builder()
        .bind(
            ineff!(GooseInput::Honk),
            PulseBinding::just_pressed(KeyCode::Space),
        )
        .build();
    ineffable.set_config(&config);
}

/// Whenever the Honk action pulses, write to the console.
fn update(ineffable: Res<Ineffable>) {
    if ineffable.just_pulsed(ineff!(GooseInput::Honk)) {
        println!("Honk!");
    }
}

More examples

Mor examples can be found in the examples/ directory. Each example is in its own file. Try out the first one by running:

cargo run --example basics

Compatible Bevy versions

bevy bevy_ineffable
0.12 0.1.0 - 0.3.0
0.13 0.4.0 - 0.5.0

Roadmap

  • Macro support
  • Recording and playing back input sequences
  • Helper functions for implementing a key re-mapping settings screen in-game.
  • Full local multiplayer support
  • Support for on-screen button prompts
  • Different input contexts
  • Maybe a tie-in to GUI?

License

Ineffable is dual-licensed under either:

at your option. This means that when using this crate in your game, you may choose which license to use.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You might also like...
Bevy is a refreshingly simple data-driven game engine built in Rust

What is Bevy? Bevy is a refreshingly simple data-driven game engine built in Rust. It is free and open-source forever! WARNING Bevy is still in the ve

Easier joystick, mouse and keyboard input handling in Bevy

ezinput A powerful input-agnostic library targeting complete support to axis and button handling for the Bevy game engine. Table of contents About Bra

Plotting library for the Bevy game engine with a focus on esthetics and interactivity
Plotting library for the Bevy game engine with a focus on esthetics and interactivity

Plotting library for the Bevy game engine with a focus on esthetics and interactivity. It can handle both data points (see the "minimal", "markers", a

Parallax mapping shaders (relief and POM) for the bevy game engine

Bevy parallax mapping parallax mapping is a graphical effect adding the impression of depth to simple 2d textures by moving the texture's pixel around

Basic first-person fly camera for the Bevy game engine

bevy_flycam A basic first-person fly camera for Bevy 0.4 Controls WASD to move horizontally SPACE to ascend LSHIFT to descend ESC to grab/release curs

Inspector plugin for the bevy game engine
Inspector plugin for the bevy game engine

bevy-inspector-egui This crate provides the ability to annotate structs with a #[derive(Inspectable)], which opens a debug interface using egui where

Crossterm plugin for the bevy game engine
Crossterm plugin for the bevy game engine

What is bevy_crossterm? bevy_crossterm is a Bevy plugin that uses crossterm as a renderer. It provides custom components and events which allow users

Concise Reference Book for the Bevy Game Engine

Unofficial Bevy Cheat Book Click here to read the book! Concise reference to programming in the Bevy game engine. Covers useful syntax, features, prog

Proof-of-concept of getting OpenXR rendering support for Bevy game engine using gfx-rs abstractions
Proof-of-concept of getting OpenXR rendering support for Bevy game engine using gfx-rs abstractions

Introduction Proof-of-concept of getting OpenXR rendering support for Bevy game engine using gfx-rs abstractions. (hand interaction with boxes missing

Bevy Simple Portals is a Bevy game engine plugin aimed to create portals.

Portals for Bevy Bevy Simple Portals is a Bevy game engine plugin aimed to create portals. Those portals are (for now) purely visual and can be used t

Sélène Amanita 11 May 28, 2023
This is an online game in which you program your character and he fights with other players

Game for programmers The goal of this project is to create a simple game for programmers. The essence of the game Each player has his own character th

Danila 1 Dec 10, 2021
Easy to use game engine

arcana Arcana is a game engine built with focus on ease of use without compromising on level of control. Getting started Starting writing a game is as

Zakarum 3 Feb 11, 2022
2d Endless Runner Game made with Bevy Game Engine

Cute-runner A 2d Endless Runner Game made with Bevy Game Engine. Table of contents Project Infos Usage Screenshots Disclaimer Project Infos Date: Sept

JoaoMarinho 2 Jul 15, 2022
A game of snake written in Rust using the Bevy game engine, targeting WebGL2

Snake using the Bevy Game Engine Prerequisites cargo install cargo-make Build and serve WASM version Set your local ip address in Makefile.toml (loca

Michael Dorst 0 Dec 26, 2021
A game made in one week for the Bevy engine's first game jam

¿Quien es el MechaBurro? An entry for the first Bevy game jam following the theme of "Unfair Advantage." It was made in one week using the wonderful B

mike 20 Dec 23, 2022
A Client/Server game networking plugin using QUIC, for the Bevy game engine.

Bevy Quinnet A Client/Server game networking plugin using QUIC, for the Bevy game engine. Bevy Quinnet QUIC as a game networking protocol Features Roa

Gilles Henaux 65 Feb 20, 2023
Bevy plugin for a simple single-line text input widget.

bevy_simple_text_input An unambitious single-line text input widget for bevy_ui. Usage See examples/basic.rs. Alternatives If you need more features,

Rob Parrett 9 Oct 3, 2023
Victorem - easy UDP game server and client framework for creating simple 2D and 3D online game prototype in Rust.

Victorem Easy UDP game server and client framework for creating simple 2D and 3D online game prototype in Rust. Example Cargo.toml [dependencies] vict

Victor Winbringer 27 Jan 7, 2023
Simple RUST game with the Bevy Engine

Simple RUST Game using the Bevy Engine YouTube videos for this code base: Episode 1 - Rust Game Development tutorial from Scratch with Bevy Engine Epi

null 150 Jan 7, 2023