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.
Usage
use bami::{Input};
impl<'s> System<'s> for MySystem {
type SystemData = (
...
Read<'s, Input<StringBindings>>,
...
);
fn run(&mut self, (..., input, ...): Self::SystemData) {
let action = String::from("jump");
let axis = String::from("horizontal");
let pressed_this_frame = input.actions.single_press(action.clone()).is_down;
let being_held_down: bool = input.actions.status(action.clone()).is_down;
let walk_speed: f32 = input.axes.status(axis.clone()).axis;
let pressed_this_frame = input.actions.single_press(action.clone()).axis;
}
}
Setup input wrapper:
use bami::{InputManagementSystem};
dispatcher_builder.add(
InputManagementSystem::<StringBindings>::default(),
"input_management_system",
&[],
);
Setup gilrs controller support:
use bami::{gilrs::GilRsControllerSystem};
dispatcher_builder.add(
GilRsControllerSystem::<StringBindings>::default(),
"gilrs_system",
&[],
);
Run tests:
cargo test --features amethyst/empty