pub fn hold(&mut self, input: &mut Read<InputHandler<String, String>>, name: &str) -> bool {
        if input.action_is_down(name).unwrap() {
            let result = *self.key_presses.get(name).unwrap();

            // special, detects at frame 0 and later on returns true all the 
            // time like in the real game
            if result == 0 || result > 16 {
                *self.key_presses.get_mut(name).unwrap() += 1;
                return true;
            }

            *self.key_presses.get_mut(name).unwrap() += 1;
        }
        else {
            *self.key_presses.get_mut(name).unwrap() = 0;
        }

        return false;
    }
// looks wether an action is held down, good for controller support later
looks wether an action is held down, good for controller support later
looks wether an action is held down good for controller support later
pub fn hold(&mut self, input: &mut Read<InputHandler<String, String>>, name: &str) -> bool {
        if input.action_is_down(name).unwrap() {
            let result = *self.key_presses.get(name).unwrap();
            // special, detects at frame 0 and later on returns true all the 
            // time like in the real game
            if result == 0 || result > 16 {
                *self.key_presses.get_mut(name).unwrap() += 1;
                return true;
            }
            *self.key_presses.get_mut(name).unwrap() += 1;
        }
        else {
            *self.key_presses.get_mut(name).unwrap() = 0;
        }
        return false;
    }
pub fn hold ( & mut self , input : & mut Read < InputHandler < String , String > > , name : & str ) -> bool { if input . action_is_down ( name ) . unwrap ( ) { let result = * self . key_presses . get ( name ) . unwrap ( ) ; // special, detects at frame 0 and later on returns true all the  // time like in the real game if result == 0 || result > 16 { * self . key_presses . get_mut ( name ) . unwrap ( ) += 1 ; return true ; } * self . key_presses . get_mut ( name ) . unwrap ( ) += 1 ; } else { * self . key_presses . get_mut ( name ) . unwrap ( ) = 0 ; } return false ; }
looks wether an action is held down, good for controller support later
looks wether an action is held down good for controller support later
&mut self
input
&mut Read<InputHandler<String, String>>
name
&str
&mut self
input
&mut Read<InputHandler<String, String>>
name
&str