/// Called by `GameScene` when an update event occurs
///
/// `miss_callback` is a function that takes a number representing the column
Called by `GameScene` when an update event occurs
`miss_callback` is a function that takes a number representing the column
Called by ` GameScene ` when an update event occurs ` miss_callback ` is a function that takes a number representing the column
pub fn update<F: FnMut(usize)>(
        &mut self,
        _args: UpdateArgs,
        config: &Config,
        chart: &dyn Chart,
        time: f64,
        mut miss_callback: F,
    ) {
        // how many notes should be removed from the front of each vecdeque since we can't modify
        // the vecdeque while we are iterating over it
        let mut to_be_removed = [0; 7];
        for (column, note_vec) in self.next_notes.iter().enumerate() {
            for &note_index in note_vec {
                let note = &chart.notes()[note_index];
                if note.end_time.unwrap_or(note.time) - time < config.game.current_judge().1.windows.last().unwrap()[1] {
                    miss_callback(column);
                    to_be_removed[column] += 1;
                }
            }
        }
        // actually remove the notes from each vecdeque
        for (column, &n) in to_be_removed.iter().enumerate() {
            for _ in 0..n {
                self.next_notes[column].pop_front();
            }
        }
        // sort the next notes by column into next_notes up to {miss_tolerance} seconds ahead
        while chart.notes().get(self.current_note_index)
            .map(|n| n.time - time < config.game.current_judge().1.miss_tolerance)
            .unwrap_or(false) {
            self.next_notes[chart.notes()[self.current_note_index].column]
                .push_back(self.current_note_index);
            self.current_note_index += 1;
        }
        for (column, opt) in self.notes_for_hitsound.iter_mut().enumerate() {
            match self.next_notes[column].front() {
                Some(&note_index) => *opt = Some(note_index),
                None => (),
            }
        }
    }
pub fn update < F : FnMut ( usize ) > ( & mut self , _args : UpdateArgs , config : & Config , chart : & dyn Chart , time : f64 , mut miss_callback : F , ) { // how many notes should be removed from the front of each vecdeque since we can't modify // the vecdeque while we are iterating over it let mut to_be_removed = [ 0 ; 7 ] ; for ( column , note_vec ) in self . next_notes . iter ( ) . enumerate ( ) { for & note_index in note_vec { let note = & chart . notes ( ) [ note_index ] ; if note . end_time . unwrap_or ( note . time ) - time < config . game . current_judge ( ) . 1 . windows . last ( ) . unwrap ( ) [ 1 ] { miss_callback ( column ) ; to_be_removed [ column ] += 1 ; } } } // actually remove the notes from each vecdeque for ( column , & n ) in to_be_removed . iter ( ) . enumerate ( ) { for _ in 0 .. n { self . next_notes [ column ] . pop_front ( ) ; } } // sort the next notes by column into next_notes up to {miss_tolerance} seconds ahead while chart . notes ( ) . get ( self . current_note_index ) . map ( | n | n . time - time < config . game . current_judge ( ) . 1 . miss_tolerance ) . unwrap_or ( false ) { self . next_notes [ chart . notes ( ) [ self . current_note_index ] . column ] . push_back ( self . current_note_index ) ; self . current_note_index += 1 ; } for ( column , opt ) in self . notes_for_hitsound . iter_mut ( ) . enumerate ( ) { match self . next_notes [ column ] . front ( ) { Some ( & note_index ) => * opt = Some ( note_index ) , None => ( ) , } } }
Called by `GameScene` when an update event occurs
`miss_callback` is a function that takes a number representing the column
Called by ` GameScene ` when an update event occurs ` miss_callback ` is a function that takes a number representing the column
&mut self
_args
UpdateArgs
config
&Config
chart
&dyn Chart
time
f64
miss_callback
F