pub fn axis_value<T: Hash + Eq + ?Sized>(&self, id: &T) -> Option<f64>
    where
        AX: Borrow<T>,
    {
        self.bindings.axes.get(id).map(|a| match a {
            &Axis::Emulated { pos, neg, .. } => {
                let pos = self.button_is_down(pos);
                let neg = self.button_is_down(neg);
                if pos == neg {
                    0.0
                } else if pos {
                    1.0
                } else {
                    -1.0
                }
            }
            &Axis::Controller {
                controller_id,
                axis,
                invert,
                dead_zone,
                ..
            } => self.controller_axes
                .iter()
                .find(|&&(id, a, _)| id == controller_id && a == axis)
                .map(|&(_, _, val)| if invert { -val } else { val })
                .map(|val| {
                    if val < -dead_zone {
                        (val + dead_zone) / (1.0 - dead_zone)
                    } else if val > dead_zone {
                        (val - dead_zone) / (1.0 - dead_zone)
                    } else {
                        0.0
                    }
                })
                .unwrap_or(0.0),
        })
    }
/// Returns the value of an axis by the string id, if the id doesn't exist this returns None.
Returns the value of an axis by the string id, if the id doesn't exist this returns None.
Returns the value of an axis by the string id if the id doesn ' t exist this returns None .
pub fn axis_value<T: Hash + Eq + ?Sized>(&self, id: &T) -> Option<f64>
    where
        AX: Borrow<T>,
    {
        self.bindings.axes.get(id).map(|a| match a {
            &Axis::Emulated { pos, neg, .. } => {
                let pos = self.button_is_down(pos);
                let neg = self.button_is_down(neg);
                if pos == neg {
                    0.0
                } else if pos {
                    1.0
                } else {
                    -1.0
                }
            }
            &Axis::Controller {
                controller_id,
                axis,
                invert,
                dead_zone,
                ..
            } => self.controller_axes
                .iter()
                .find(|&&(id, a, _)| id == controller_id && a == axis)
                .map(|&(_, _, val)| if invert { -val } else { val })
                .map(|val| {
                    if val < -dead_zone {
                        (val + dead_zone) / (1.0 - dead_zone)
                    } else if val > dead_zone {
                        (val - dead_zone) / (1.0 - dead_zone)
                    } else {
                        0.0
                    }
                })
                .unwrap_or(0.0),
        })
    }
pub fn axis_value < T : Hash + Eq + ? Sized > ( & self , id : & T ) -> Option < f64 > where AX : Borrow < T > , { self . bindings . axes . get ( id ) . map ( | a | match a { & Axis :: Emulated { pos , neg , .. } => { let pos = self . button_is_down ( pos ) ; let neg = self . button_is_down ( neg ) ; if pos == neg { 0.0 } else if pos { 1.0 } else { - 1.0 } } & Axis :: Controller { controller_id , axis , invert , dead_zone , .. } => self . controller_axes . iter ( ) . find ( | & & ( id , a , _ ) | id == controller_id && a == axis ) . map ( | & ( _ , _ , val ) | if invert { - val } else { val } ) . map ( | val | { if val < - dead_zone { ( val + dead_zone ) / ( 1.0 - dead_zone ) } else if val > dead_zone { ( val - dead_zone ) / ( 1.0 - dead_zone ) } else { 0.0 } } ) . unwrap_or ( 0.0 ) , } ) }
Returns the value of an axis by the string id, if the id doesn't exist this returns None.
Returns the value of an axis by the string id if the id doesn ' t exist this returns None .
&self
id
&T
&self
id
&T