# `bami`

The basic amethyst input library. Offers simple utility for input with the `amethyst` crate.

Controller support can be added through the `gilrs` feature.

This crate is a work in progress, some controller bindings may not yet be supported.

## Setup :
```rust
use bami::BamiBundle;

let game_data = GameDataBuilder::default()
    ...
    .with_bundle(BamiBundle::<StringBindings>::default())?
    // ^------ Add this bundle AFTER the `InputBundle`
    // Feel free to replace `StringBindings` with a custom type
    ...
```

## Usage :
Feel free to replace `StringBindings` with a custom type in your code!
```rust
use bami::{Input};

// Inside a system
type SystemData = Read<'s, Input<StringBindings>>;
    
fn run(&mut self, input: Self::SystemData) {
    let action = String::from("jump");

    // Only true the first frame an input is pressed
    let pressed_this_frame = 
        input.actions.single_press(&action).is_down;

    // The current state of the action
    // `true` every frame the action is held
    let being_held_down: bool =
        input.actions.status(&action).is_down;

    let axis = String::from("horizontal");

    // Axis value between [-1.0, 1.0].
    let walk_speed: f32 =
        input.axes.status(&axis).axis;

    // Axes can also be used for menus
    let menu_axis =
        input.axes.single_press(&axis).is_down;
}
```

## Run tests:
```
cargo test --features amethyst/empty
```
