internal void Flush()
            {
                if (Active)
                {
                    PerfTime now = PerfTime.Now;

                    TotalTime += (now - StartTime);
                    StartTime  = now;
                }
            }
Example #2
0
        internal void Resume()
        {
            if (_paused)
            {
                PerfTimeSpan pauseDelta = PerfTime.Now - _pauseStarted;

                _lastFrameTime += pauseDelta;
                _lastFpsTime += pauseDelta;
                _paused = false;
            }
        }
Example #3
0
 internal GameTime()
 {
     _lastFrameTime = PerfTime.Now;
     _lastFpsTime = _lastFrameTime;
 }
Example #4
0
 internal void Pause()
 {
     if (!_paused)
     {
         _paused = true;
         _pauseStarted = PerfTime.Now;
     }
 }
Example #5
0
        internal void UpdateFrame()
        {
            PerfTime thisFrameSnapshot = PerfTime.Now;
            PerfTimeSpan timeDelta = thisFrameSnapshot - _lastFrameTime;
            PerfTimeSpan fpsTimeDelta = thisFrameSnapshot - _lastFpsTime;

            _frameCounter++;
            _fpsFrameCounter++;

            if (fpsTimeDelta.Seconds >= _fpsMeasureTimeFrame)
            {
                _fps = (_fpsFrameCounter) / (float)fpsTimeDelta.Seconds;
                _fpsFrameCounter = 0;
                _lastFpsTime = thisFrameSnapshot;
            }

            _frameTime = Math.Min((float)timeDelta.Seconds, MAX_TIME_DELTA);
            _totalGameTime += _frameTime;
            _lastFrameTime = thisFrameSnapshot;
        }