bami
The basic amethyst input library. Offers simple abstractions for common input requirements when using 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.
```rust use bami::{Input};
impl<'s> System<'s> for MySystem {
type SystemData = (
...
// Replace StringBindings
if needed
Read<'s, Input
fn run(&mut self, (..., input, ...): Self::SystemData) {
let action = String::from("jump");
let axis = String::from("horizontal");
// Only true the first frame an input is pressed
let pressed_this_frame = input.actions.single_press(action.clone()).is_down;
// The current state of the action
let being_held_down: bool = input.actions.status(action.clone()).is_down;
// Value between [-1.0, 1.0]
let walk_speed: f32 = input.axes.status(axis.clone()).axis;
// For every action, there is also the possibility to query the axis value.
// If the queried behaviour would return `is_down = false`, the axis value will be `0.0`.
let pressed_this_frame = input.actions.single_press(action.clone()).axis;
}
} ```
```rust use bami::{InputManagementSystem};
// Add this to your dispatcher
dispatcherbuilder.add(
// Replace StringBindings
if needed
InputManagementSystem::
```rust use bami::{gilrs::GilRsControllerSystem};
// Add this to your dispatcher BEFORE the InputManagementSystem
dispatcherbuilder.add(
// Replace StringBindings
if needed
GilRsControllerSystem::
cargo test --features amethyst/empty