src/emulation/emulation.cc
/*
 * Updates the SDL window with the current running frame rate every
 * 60 frames.
 */
Updates the SDL window with the current running frame rate every
60 frames.
Updates the SDL window with the current running frame rate every 60 frames .
void Emulation::UpdateFrameCounter(void) {
  frames_counted_++;
  EmuTime current_time, diff;
  if (frames_counted_ >= NES_FRAME_RATE) {
    TimeGet(&current_time);
    TimeDiff(&current_time, &last_frame_time_, &diff);
    float secs_passed = (static_cast<float>(diff.tv_sec))
                      + ((static_cast<float>(diff.tv_nsec))
                      / (static_cast<float>(NSECS_PER_SEC)));
    window_->DisplayFps((static_cast<float>(frames_counted_)) / secs_passed);
    frames_counted_ = 0;
    last_frame_time_.tv_sec = current_time.tv_sec;
    last_frame_time_.tv_nsec = current_time.tv_nsec;
  }
  return;
}
void Emulation :: UpdateFrameCounter ( void ) { frames_counted_ ++ ; EmuTime current_time , diff ; if ( frames_counted_ >= NES_FRAME_RATE ) { TimeGet ( & current_time ) ; TimeDiff ( & current_time , & last_frame_time_ , & diff ) ; float secs_passed = ( static_cast < float > ( diff . tv_sec ) ) + ( ( static_cast < float > ( diff . tv_nsec ) ) / ( static_cast < float > ( NSECS_PER_SEC ) ) ) ; window_ -> DisplayFps ( ( static_cast < float > ( frames_counted_ ) ) / secs_passed ) ; frames_counted_ = 0 ; last_frame_time_ . tv_sec = current_time . tv_sec ; last_frame_time_ . tv_nsec = current_time . tv_nsec ; } return ; }
Updates the SDL window with the current running frame rate every
 60 frames.
Updates the SDL window with the current running frame rate every 60 frames .
// Counts how many frames have been run. // Determine if it is time to update the frame rate display. // Update the frame rate display. // Update the last called time.