bevy_input_bindings 0.0.2

High level, flexible and shareable input binding library for the Bevy game engine
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use bevy::ecs::component::Component;

use crate::gamepad::triggers::TriggerTrait;
use crate::gamepad::values::FunctionTrait;

/// Trait to implement for a gamepad binding. The component will be added to the controller entity.
/// Which will allow for remapping on the fly.
pub trait GamepadBinding<ActionKey, ValueKey>: Default + Component {
    fn get_action_bindings<'a>(&'a mut self) -> Vec<(&'a mut dyn TriggerTrait, ActionKey)> {
        return vec![];
    }

    fn get_value_bindings<'a>(&'a mut self) -> Vec<(&'a mut dyn FunctionTrait, ValueKey)> {
        return vec![];
    }
}